1.0.7 • Published 3 years ago

@infa-toolkit/route-tracking v1.0.7

Weekly downloads
-
License
INFA GmbH
Repository
gitlab
Last release
3 years ago

infa-route-tracking

Route Tracking gathers GPS information (usually for vehicles) while running in the background to provide a full sequence of the driven route over several hours.

Install

npm install @infa-toolkit/route-tracking
npx cap sync

API

echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>

Returns the given value after showing it in the native logging prompt (e.g. LogCat)<br> <i>This is a default plugin method.</i>

ParamType
options{ value: string; }

Returns: Promise<{ value: string; }>


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Returns the permission status required by the plugin.<br> <i>This is a standard plugin method.</i>

Returns: Promise<PermissionStatus>


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Requests the permissions required by the plugin and returns the status.<br> <i>This is a standard plugin method.</i>

Returns: Promise<PermissionStatus>


addListener(string, ...)

addListener(eventName: string, listenerFunc: ListenerCallback) => Promise<PluginListenerHandle> & PluginListenerHandle

Add a callback function to react on a native event, even while the hosting application is not showing in the foreground.<br> <i>This is a standard plugin method.</i>

ParamType
eventNamestring
listenerFuncListenerCallback

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


getStatus()

getStatus() => Promise<RouteTrackingServiceStatusResult>

Returns the status of the service.<br>

Returns: Promise<RouteTrackingServiceStatusResult>


start(...)

start(config: RouteTrackingProviderConfiguration) => Promise<void>

Starts the native route tracking daemon.<br> Consider to clear the native storage immediately after starting the tracking to make sure, that the records will not merge with previous tracks.

ParamType
configRouteTrackingProviderConfiguration

restore()

restore() => Promise<void>

Attempts to restore to a running native route tracking daemon.<br> Use this method if your app has crashed during a running session to restore the broadcast receivers, which notify the listeners on each event.


stop()

stop() => Promise<void>

Stops the native route tracking daemon.<br> Consider to continue with <code>fetch()</code> and <code>clear()</code> after stopping was successful to make sure, that all remaining locations will be transferred to the host.


fetch(...)

fetch(limit?: number | undefined) => Promise<RouteTrackingFetchResult>

Requests and returns cached locations from the native storage.<br> The locations will be returned beginning with the oldest entry up to the newest one, ordered by <code>RouteTrackingGeolocation.timestamp</code> ascending.<br> Make sure to delete the locations after successfully storing them to your local host-application by subsequently calling <code>clear()</code>.

ParamTypeDescription
limitnumberMaximum number of returned locations at once. If unset, the method returns all stored records.

Returns: Promise<RouteTrackingFetchResult>


clear(...)

clear(time?: number | undefined) => Promise<void>

Removes all locations from the native storage. If the timestamp is set, only locations with a timestamp lower or equal to the given timestamp will be considered for removal.<br> <i>Use the time of the latest returned location when chaining clear with fetch.</i>

ParamType
timenumber

Interfaces

PermissionStatus

PropTypeDescription
locationPermissionStateThe naming must match the permission alias set up in the plugin´s annotations.

PluginListenerHandle

PropType
remove() => Promise<void>

RouteTrackingServiceStatusResult

PropType
codeRouteTrackingServiceStatus

RouteTrackingProviderConfiguration

PropTypeDescriptionDefault
intervalnumberSet the desired interval of a location request, in milliseconds.
priorityRouteTrackingPrioritySet the quality of the request. - HIGH_ACCURACY = 100 - BALANCED_POWER_ACCURACY = 102 - LOW_POWER = 104 - NO_POWER = 105100
smallestDisplacementnumberSet the minimum displacement between location updates in meters. If unset, this criteria is disabled.null

RouteTrackingFetchResult

PropType
itemsRouteTrackingGeolocation[]

RouteTrackingGeolocation

PropTypeDescription
latitudenumberCoordinate latitude value between -90° and 90°
longitudenumberCoordinate longitude value between -180° and 180°
altitudenumberCoordinate altitude value in meters above sea level
timenumberUnix epoch time of this location based on milliseconds since 00:00:00 January 1 1970 UTC
speednumberApproximate speed in meters per second
bearingnumberApproximate bearing in degrees from 0° (North) over 90° (East) clockwise
accuracynumberHorizontal coordinate accuracy in meters from the real location
speedAccuracynumberSpeed accuracy in meters per second from the real speed
bearingAccuracynumberBearing accuracy in degrees from the real bearing
verticalAccuracynumberVertical coordinate accuracy in meters below / above the real altitude

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

ListenerCallback

(err: any, ...args: any[]): void

Enums

RouteTrackingServiceStatus

MembersValue
INACTIVE0
ACTIVE1

RouteTrackingPriority

MembersValue
HIGH_ACCURACY100
BALANCED_POWER_ACCURACY102
LOW_POWER104
NO_POWER105
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.3-beta1

3 years ago

1.0.2-beta2

3 years ago

1.0.2-beta1

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago

0.0.21

3 years ago