INFA-Background Geolocation
bash
npm install bglocng17
npx cap sync
`
API
echo(...)
* checkPermissions()
* requestPermissions()
* start(...)
* stop()
* getLocations(...)
* getStoredLocationsCount()
* getAll()
* confirmReception(...)
* upload(...)
* cleanup(...)
* addListener(string, ...)
* on(...)
* Interfaces
* Type Aliases
$3
`typescript
echo(options: { value: string; }) => Promise<{ value: string; }>
`| Param | Type |
| ------------- | ------------------------------- |
|
options | { value: string; } |Returns: Promise<{ value: string; }>
--------------------
$3
`typescript
checkPermissions() => Promise
`Returns: Promise<PermissionStatus>
--------------------
$3
`typescript
requestPermissions() => Promise
`Returns: Promise<PermissionStatus>
--------------------
$3
`typescript
start(config: InfaBgLocConfig) => Promise
`| Param | Type |
| ------------ | ----------------------------------------------------------- |
|
config | InfaBgLocConfig |--------------------
$3
`typescript
stop() => Promise
`--------------------
$3
`typescript
getLocations(options: InfaBgLocFetchOptions) => Promise
`| Param | Type |
| ------------- | ----------------------------------------------------------------------- |
|
options | InfaBgLocFetchOptions |Returns: Promise<InfaBgLocationArray>
--------------------
$3
`typescript
getStoredLocationsCount() => Promise
`Returns: Promise<InfaBgLocationCount>
--------------------
$3
`typescript
getAll() => Promise
`Returns: Promise<InfaBgLocationArray>
--------------------
$3
`typescript
confirmReception(options: InfaBgLocConfirmReceptionOptions) => Promise
`| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------- |
|
options | InfaBgLocConfirmReceptionOptions |--------------------
$3
`typescript
upload(config: InfaBgLocSessionConfig) => Promise
`| Param | Type |
| ------------ | ------------------------------------------------------------------------- |
|
config | InfaBgLocSessionConfig |--------------------
$3
`typescript
cleanup(options?: InfaBgLocCleanupSessionOptions | InfaBgLocCleanupByIdsOptions | undefined) => Promise
`| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
options | InfaBgLocCleanupSessionOptions \| InfaBgLocCleanupByIdsOptions |--------------------
$3
`typescript
addListener(eventName: string, listenerFunc: ListenerCallback) => Promise & PluginListenerHandle
`| Param | Type |
| ------------------ | ------------------------------------------------------------- |
|
eventName | string |
| listenerFunc | ListenerCallback |Returns: Promise<PluginListenerHandle> & PluginListenerHandle
--------------------
$3
`typescript
on(eventName: string) => Observable
`| Param | Type |
| --------------- | ------------------- |
|
eventName | string |Returns: Observable<any>
--------------------
$3
#### PermissionStatus
| Prop | Type |
| -------------- | ----------------------------------------------------------- |
|
location | PermissionState |
#### InfaBgLocConfig
Used to configure the background service
#### InfaBgLocationArray
| Prop | Type |
| ----------- | ----------------------------- |
|
items | InfaBgLocation[] |
#### InfaBgLocation
| Prop | Type |
| -------------------------- | ------------------- |
|
id | number |
| sessionToken | string |
| time | number |
| latitude | number |
| longitude | number |
| altitude | number |
| speed | number |
| bearing | number |
| angularSpeed | number |
| accuracy | number |
| verticalAccuracy | number |
| speedAccuracy | number |
| bearingAccuracy | number |
| angularSpeedAccuracy | number |
| nanos | number |
| provider | string |
| latitudeRaw | number |
| longitudeRaw | number |
#### InfaBgLocFetchOptions
| Prop | Type | Description | Default |
| ---------------------------- | -------------------- | ----------------------------------------------------------------------------------------- | ------------------ |
|
sessionToken | string | Set the session to retrieve the locations for. (required) | |
| limit | number | Limits the number of returned locations and retrieves the oldest entries. | null |
| ignoreTransmissionFlag | boolean | Get the entire dataset for this session, regardless of the current app-transmission flag. | false |
#### InfaBgLocationCount
| Prop | Type |
| ----------- | ------------------- |
|
count | number |
#### InfaBgLocConfirmReceptionOptions
| Prop | Type | Description |
| ------------------ | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
sessionToken | string | Set the session to confirm the reception |
| ids | number[] | Set the array of ids handled within the application to mark all locations within the native plugin as handled up to this one. |
#### InfaBgLocSessionConfig
| Prop | Type | Description | Default |
| ------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------ |
|
sessionToken | string | | |
| httpUrl | string | If set, the service will post the recorded locations to the given server url end-point as soon as there is a valid internet connection available. The data will be sent as POST-Method and (actually) without any authorization header. Therefore the end-point should allow anonymous access. | null |
| httpPostTemplate | string | Defines the JSON-based template used for sending a location to the server. Please use the following wildcards as desired: - %id% (the auto-incremental identifier for every recorded location) - %sessionToken% (the identifier used for the particular recording session) - %apiSendStatus% (retrieves 0 or 1, whether the location has been flagged to already be sent to the server) - %appSendStatus% (retrieves 0 or 1, whether the location has been flagged to already be collected by the app itself) - %time% (the location's UTC time fix, in milliseconds since epoch (January 1, 1970).) - %latitude% (the latitude, in degrees) - %longitude% (the longitude, in degrees) - %altitude% (the altitude if available, in meters above the WGS 84 reference ellipsoid.) - %speed% (the speed if it is available, in meters/second over ground.) - %bearing% (the bearing, in degrees [0..360]) - %horizontalAccuracy% (the estimated horizontal accuracy of this location, radial, in meters.) - %verticalAccuracy% (the estimated vertical accuracy of this location, in meters.) - %speedAccuracy% (the estimated speed accuracy of this location, in meters per second.) - %bearingAccuracy% (the estimated bearing accuracy of this location, in degrees.) - %nanos% (the time of this fix, in elapsed real-time since system boot.) - %provider% (the name of the provider that generated this fix.) | |
| httpAuthentication | string | | |
| httpPostLimit | number | Defines the number of locations maximal sent to the server at once. | MAX_INTEGER |
| httpPostFrequency | number | Defines the server upload frequency in milliseconds. | 10000 |
| idleTimeUntilNotification | number | When the location has not changed during the given amount of milliseconds, the service returns a notification. The default time is 4620000 | |
| waitForClientCollection | boolean | Indicates, whether a location shall wait for the client to be collected, before it can be (regularly) cleared from the storage. | |
| backgroundService | boolean | Allows the service to persist in the background, although the main app itself might have been shut down already. | false |
#### InfaBgLocCleanupSessionOptions
| Prop | Type | Description | Default |
| ------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- |
|
sessionToken | string | The session to be cleaned up. (required) | |
| minSessionAge | number | Defines the minimum age of the session in days, before it can be discarded. A value of 0 allows the service to immediately delete the location. | 0 |
| forceCleanup | boolean | All locations have to be posted to a server (through HTTP-POST) by the native upload client, before any location of the session will be deleted. | true |
#### InfaBgLocCleanupByIdsOptions
| Prop | Type | Description |
| --------- | --------------------- | ------------------------- |
|
ids | number[] | The ids to be cleaned up. |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
|
remove` | () => Promise<void> |
#### PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
#### ListenerCallback
(err: any, ...args: any[]): void