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.
npm install infa-route-tracking
npx cap sync
echo(...)
checkPermissions()
requestPermissions()
addListener(string, ...)
getStatus()
start(...)
stop()
fetch(...)
clear(...)
- Interfaces
- Type Aliases
- Enums
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>
Param | Type |
---|---|
options |
{ value: string; } |
Returns: Promise<{ value: string; }>
checkPermissions() => Promise<PermissionStatus>
Returns the permission status required by the plugin.<br> <i>This is a standard plugin method.</i>
Returns: Promise<PermissionStatus>
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(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>
Param | Type |
---|---|
eventName |
string |
listenerFunc |
ListenerCallback |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
getStatus() => Promise<RouteTrackingServiceStatusResult>
Returns the status of the service.<br>
Returns: Promise<RouteTrackingServiceStatusResult>
start(config: RouteTrackingConfiguration) => 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.
Param | Type |
---|---|
config |
RouteTrackingConfiguration |
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(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>.
Param | Type | Description |
---|---|---|
limit |
number |
Maximum number of returned locations at once. If unset, the method returns all stored records. |
Returns: Promise<RouteTrackingFetchResult>
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>
Param | Type |
---|---|
time |
number |
Prop | Type | Description |
---|---|---|
location |
PermissionState |
The naming must match the permission alias set up in the plugin´s annotations. |
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type |
---|---|
code |
RouteTrackingServiceStatus |
Prop | Type | Description | Default |
---|---|---|---|
interval |
number |
Set the desired interval of a location request, in milliseconds. | |
priority |
RouteTrackingPriority |
Set the quality of the request. - HIGH_ACCURACY = 100 - BALANCED_POWER_ACCURACY = 102 - LOW_POWER = 104 - NO_POWER = 105 | 100 |
smallestDisplacement |
number |
Set the minimum displacement between location updates in meters. If unset, this criteria is disabled. | null |
handler |
RouteTrackingLocationCallbackHandler |
Set a callback handler to store or process fetched locations locally. Assume, there array of locations is not empty. |
Prop | Type | Description |
---|---|---|
latitude |
number |
Coordinate latitude value between -90° and 90° |
longitude |
number |
Coordinate longitude value between -180° and 180° |
altitude |
number |
Coordinate altitude value in meters above sea level |
time |
number |
Unix epoch time of this location based on milliseconds since 00:00:00 January 1 1970 UTC |
speed |
number |
Approximate speed in meters per second |
bearing |
number |
Approximate bearing in degrees from 0° (North) over 90° (East) clockwise |
accuracy |
number |
Horizontal coordinate accuracy in meters from the real location |
speedAccuracy |
number |
Speed accuracy in meters per second from the real speed |
bearingAccuracy |
number |
Bearing accuracy in degrees from the real bearing |
verticalAccuracy |
number |
Vertical coordinate accuracy in meters below / above the real altitude |
Prop | Type |
---|---|
items |
RouteTrackingGeolocation[] |
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
(err: any, ...args: any[]): void
(locations: RouteTrackingGeolocation[]): Promise<number>
Members | Value |
---|---|
INACTIVE |
0 |
ACTIVE |
1 |
Members | Value |
---|---|
HIGH_ACCURACY |
100 |
BALANCED_POWER_ACCURACY |
102 |
LOW_POWER |
104 |
NO_POWER |
105 |