@transistorsoft/capacitor-background-geolocation 4.9.4 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +8 -10
- package/android/libs/com/transistorsoft/tslocationmanager/{3.2.10/tslocationmanager-3.2.10.aar → 3.3.1/tslocationmanager-3.3.1.aar} +0 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.aar.md5 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.aar.sha1 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.aar.sha256 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.aar.sha512 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/{3.2.10/tslocationmanager-3.2.10.pom → 3.3.1/tslocationmanager-3.3.1.pom} +1 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.pom.md5 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.pom.sha1 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.pom.sha256 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/3.3.1/tslocationmanager-3.3.1.pom.sha512 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml +4 -8
- package/android/libs/com/transistorsoft/{tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar → tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.aar} +0 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.aar.md5 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.aar.sha1 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.aar.sha256 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.aar.sha512 +1 -0
- package/android/libs/com/transistorsoft/{tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom → tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.pom} +2 -2
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.pom.md5 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.pom.sha1 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.pom.sha256 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/3.3.1/tslocationmanager-v21-3.3.1.pom.sha512 +1 -0
- package/android/libs/com/transistorsoft/tslocationmanager-v21/maven-metadata.xml +13 -0
- package/dist/declarations/interfaces/Authorization.d.ts +2 -1
- package/dist/declarations/interfaces/Location.d.ts +25 -1
- package/dist/declarations/interfaces/MotionActivityEvent.d.ts +5 -2
- package/dist/declarations/types.d.ts +16 -0
- package/package.json +1 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.md5 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha1 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha256 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha512 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.md5 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha1 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha256 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha512 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.md5 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha1 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha256 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha512 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.md5 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha1 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha256 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha512 +0 -1
- package/android/libs/com/transistorsoft/tslocationmanager-reverse/maven-metadata.xml +0 -17
- package/dist/declarations/Authorization.d.ts +0 -184
- package/dist/declarations/AuthorizationEvent.d.ts +0 -30
- package/dist/declarations/Config.d.ts +0 -2457
- package/dist/declarations/ConnectivityChangeEvent.d.ts +0 -18
- package/dist/declarations/CurrentPositionRequest.d.ts +0 -45
- package/dist/declarations/DeviceInfo.d.ts +0 -33
- package/dist/declarations/DeviceSettings.d.ts +0 -223
- package/dist/declarations/Geofence.d.ts +0 -255
- package/dist/declarations/GeofenceEvent.d.ts +0 -30
- package/dist/declarations/GeofencesChangeEvent.d.ts +0 -22
- package/dist/declarations/HeartbeatEvent.d.ts +0 -20
- package/dist/declarations/HttpEvent.d.ts +0 -313
- package/dist/declarations/Location.d.ts +0 -225
- package/dist/declarations/LocationAuthorizationAlert.d.ts +0 -41
- package/dist/declarations/Logger.d.ts +0 -359
- package/dist/declarations/MotionActivityEvent.d.ts +0 -31
- package/dist/declarations/MotionChangeEvent.d.ts +0 -15
- package/dist/declarations/Notification.d.ts +0 -491
- package/dist/declarations/PermissionRationale.d.ts +0 -31
- package/dist/declarations/ProviderChangeEvent.d.ts +0 -74
- package/dist/declarations/SQLQuery.d.ts +0 -60
- package/dist/declarations/Sensors.d.ts +0 -31
- package/dist/declarations/State.d.ts +0 -51
- package/dist/declarations/Subscription.d.ts +0 -104
- package/dist/declarations/TransistorAuthorizationToken.d.ts +0 -63
- package/dist/declarations/WatchPositionRequest.d.ts +0 -45
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* The event-object provided to [[BackgroundGeolocation.onConnectivityChange]]
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* BackgroundGeolocation.onConnectivityChange(connectivityChangeEvent => {
|
|
8
|
-
* console.log("[connectivitychange] ", connectivityChangeEvent.connected);
|
|
9
|
-
* });
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
interface ConnectivityChangeEvent {
|
|
13
|
-
/**
|
|
14
|
-
* `true` when the device has access to a network connection.
|
|
15
|
-
*/
|
|
16
|
-
connected: boolean;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* Options provided to [[getCurrentPosition]].
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* let location = await BackgroundGeolocation.getCurrentPosition({
|
|
8
|
-
* timeout: 30, // 30 second timeout to fetch location
|
|
9
|
-
* persist: true, // Defaults to state.enabled
|
|
10
|
-
* maximumAge: 5000, // Accept the last-known-location if not older than 5000 ms.
|
|
11
|
-
* desiredAccuracy: 10, // Try to fetch a location with an accuracy of `10` meters.
|
|
12
|
-
* samples: 3, // How many location samples to attempt.
|
|
13
|
-
* extras: { // Custom meta-data.
|
|
14
|
-
* "route_id": 123
|
|
15
|
-
* }
|
|
16
|
-
* });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
interface CurrentPositionRequest {
|
|
20
|
-
/**
|
|
21
|
-
* Sets the maximum number of location-samples to fetch before returning the best possible location to your `callback`. Default is `3`. Only the final Location will be persisted.
|
|
22
|
-
*/
|
|
23
|
-
samples?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Sets the desired accuracy of location you're attempting to fetch. When a location having `accuracy <= desiredAccuracy` is retrieved, the plugin will stop sampling and immediately return that location. Defaults to your configured [[Config.stationaryRadius]].
|
|
26
|
-
*/
|
|
27
|
-
desiredAccuracy?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Location-timeout in `seconds`. Default: `30`. If the timeout expires before a [[Location]] is retrieved, a [[LocationError]] will fire.
|
|
30
|
-
*/
|
|
31
|
-
timeout?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Defaults to `true` when plugin is `enabled`; `false`, otherwise. Set `false` to disable persisting the retrieved Location in the plugin's SQLite database.
|
|
34
|
-
*/
|
|
35
|
-
persist?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Accept the last-recorded-location if no older than supplied value in `milliseconds`. Default is `0`.
|
|
38
|
-
*/
|
|
39
|
-
maximumAge?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Optional meta-data to attach to the location. These `extras` will be merged to the configured [[Config.extras]] and persisted / POSTed to your server (if you've configured a [[Config.url]].
|
|
42
|
-
*/
|
|
43
|
-
extras?: Extras;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* Simple device information, much simpler than other 3rd party libraries.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* let deviceInfo = await BackgroundGeolocation.getDeviceInfo();
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
interface DeviceInfo {
|
|
11
|
-
/**
|
|
12
|
-
* Device model
|
|
13
|
-
*/
|
|
14
|
-
model:string;
|
|
15
|
-
/**
|
|
16
|
-
* Device manufacturer.
|
|
17
|
-
*/
|
|
18
|
-
manufacturer:string;
|
|
19
|
-
/**
|
|
20
|
-
* OS Version code.
|
|
21
|
-
*/
|
|
22
|
-
version:string;
|
|
23
|
-
/**
|
|
24
|
-
* Platform: iOS or Android
|
|
25
|
-
*/
|
|
26
|
-
platform:string;
|
|
27
|
-
/**
|
|
28
|
-
* Development framework (react-native or cordova)
|
|
29
|
-
*/
|
|
30
|
-
framework:string;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* An object for redirecting a User to an Android device's settings screen from a [DeviceSettings] request.
|
|
4
|
-
*
|
|
5
|
-
* This object contains meta-data about the device ([[manufacturer]\], [[model]], [[version]]) in addition to a flag [seen] to let you know if you've
|
|
6
|
-
* already shown some particular screen to the user. [[lastSeenAt]] lets you know the `DateTime` you last showed a particular screen to the user.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
interface DeviceSettingsRequest {
|
|
10
|
-
/**
|
|
11
|
-
* Device manufacturer.
|
|
12
|
-
*/
|
|
13
|
-
manufacturer: string;
|
|
14
|
-
/**
|
|
15
|
-
* Device model
|
|
16
|
-
*/
|
|
17
|
-
model: string;
|
|
18
|
-
/**
|
|
19
|
-
* OS version
|
|
20
|
-
*/
|
|
21
|
-
version: string;
|
|
22
|
-
/**
|
|
23
|
-
* Flag showing whether you've already shown this screen to the user.
|
|
24
|
-
*/
|
|
25
|
-
seen: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The [DateTime] you last showed this screen to the user.
|
|
28
|
-
*/
|
|
29
|
-
lastSeenAt: Date;
|
|
30
|
-
/**
|
|
31
|
-
* The settings screen to be shown.
|
|
32
|
-
*
|
|
33
|
-
* ⚠️ This property is set automatically.
|
|
34
|
-
*/
|
|
35
|
-
action: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Device Settings API.
|
|
40
|
-
*
|
|
41
|
-
* Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can affect performance of the Background Geolocation SDK on various devices.
|
|
42
|
-
*
|
|
43
|
-
* The site [Don't Kill My App](https://dontkillmyapp.com/) provides a comprehensive list of poor Android vendors which throttle background-services that this plugin relies upon.
|
|
44
|
-
*
|
|
45
|
-
* This `DeviceSettings` API is an attempt to provide resources to direct the user to the appropriate vendor-specific settings screen to resolve issues with background operation.
|
|
46
|
-
*
|
|
47
|
-
* 
|
|
48
|
-
* 
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* // Is Android device ignoring battery optimizations?
|
|
53
|
-
* let isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
|
|
54
|
-
* if (!isIgnoring) {
|
|
55
|
-
* BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations().then((request:DeviceSettingsRequest) => {
|
|
56
|
-
* console.log(`- Screen seen? ${request.seen} ${request.lastSeenAt}`);
|
|
57
|
-
* console.log(`- Device: ${request.manufacturer} ${request.model} ${request.version}`);
|
|
58
|
-
*
|
|
59
|
-
* // If we've already shown this screen to the user, we don't want to annoy them.
|
|
60
|
-
* if (request.seen) {
|
|
61
|
-
* return;
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
64
|
-
* // It's your responsibility to instruct the user what exactly
|
|
65
|
-
* // to do here, perhaps with a Confirm Dialog:
|
|
66
|
-
* showMyConfirmDialog({
|
|
67
|
-
* title: "Settings request",
|
|
68
|
-
* text: "Please disable battery optimizations for your device"
|
|
69
|
-
* }).then((confirmed) => {
|
|
70
|
-
* if (confirmed) {
|
|
71
|
-
* // User clicked [Confirm] button. Execute the redirect to settings screen:
|
|
72
|
-
* BackgroundGeolocation.deviceSettings.show(request);
|
|
73
|
-
* }
|
|
74
|
-
* });
|
|
75
|
-
* }).catch((error) => {
|
|
76
|
-
* // Depending on Manufacturer/Model/OS Version, a Device may not implement
|
|
77
|
-
* // a particular Settings screen.
|
|
78
|
-
* console.warn(error);
|
|
79
|
-
* });
|
|
80
|
-
* }
|
|
81
|
-
*
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
interface DeviceSettings {
|
|
85
|
-
/**
|
|
86
|
-
* Returns `true` if device is ignoring battery optimizations for your app.
|
|
87
|
-
*
|
|
88
|
-
* In most cases, the Background Geolocation SDK **will perform normally** with battery optimizations.
|
|
89
|
-
*
|
|
90
|
-
* 
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* let isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
isIgnoringBatteryOptimizations():Promise<boolean>;
|
|
98
|
-
/**
|
|
99
|
-
* Shows the Android *Ignore Battery Optimizations* settings screen.
|
|
100
|
-
*
|
|
101
|
-
* **Note:** In most cases, the plugin **will perform normally** with battery optimizations. You should only instruct the user to *Ignore Battery Optimizations* for your app as a last resort to resolve issues with background operation.
|
|
102
|
-
*
|
|
103
|
-
* 
|
|
104
|
-
*
|
|
105
|
-
* **WARNING:** Ignoring battery optimizations *will* cause your app to consume **much** more power.
|
|
106
|
-
*
|
|
107
|
-
* `showIgnoreBatteryOptimizations` does **not** immediately redirect to the desired Device settings screen. Instead, it first returns a [[DeviceSettingsRequest]], containing
|
|
108
|
-
* meta-data about the device (`manufacturer`, `model`, `version`), in addition to a flags `seen` and `lastSeenAt`, letting you know if and when you've already shown this screen to the user.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* In your success-callback, it's completely **up to you** to instruct the user what exactly to do on that screen.
|
|
112
|
-
*
|
|
113
|
-
* Based upon the manufacturer/model/os, a Device may not have this particular Settings screen implemented. In this case, `catch` will fire.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* // Is Android device ignoring battery optimizations?
|
|
118
|
-
* let isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
|
|
119
|
-
* if (!isIgnoring) {
|
|
120
|
-
* BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations().then((request:DeviceSettingsRequest) => {
|
|
121
|
-
* console.log(`- Screen seen? ${request.seen} ${request.lastSeenAt}`);
|
|
122
|
-
* console.log(`- Device: ${request.manufacturer} ${request.model} ${request.version}`);
|
|
123
|
-
*
|
|
124
|
-
* // If we've already shown this screen to the user, we don't want to annoy them.
|
|
125
|
-
* if (request.seen) {
|
|
126
|
-
* return;
|
|
127
|
-
* }
|
|
128
|
-
*
|
|
129
|
-
* // It's your responsibility to instruct the user what exactly
|
|
130
|
-
* // to do here, perhaps with a Confirm Dialog:
|
|
131
|
-
* showMyConfirmDialog({
|
|
132
|
-
* title: "Settings request",
|
|
133
|
-
* text: "Please disable battery optimizations for your device"
|
|
134
|
-
* }).then((confirmed) => {
|
|
135
|
-
* if (confirmed) {
|
|
136
|
-
* // User clicked [Confirm] button. Execute the redirect to settings screen:
|
|
137
|
-
* BackgroundGeolocation.deviceSettings.show(request);
|
|
138
|
-
* }
|
|
139
|
-
* });
|
|
140
|
-
* }).catch((error) => {
|
|
141
|
-
* // Depending on Manufacturer/Model/OS Version, a Device may not implement
|
|
142
|
-
* // a particular Settings screen.
|
|
143
|
-
* console.warn(error);
|
|
144
|
-
* });
|
|
145
|
-
* }
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
showIgnoreBatteryOptimizations():Promise<DeviceSettingsRequest>;
|
|
150
|
-
/**
|
|
151
|
-
* Shows a vendor-specific "Power Management" screen.
|
|
152
|
-
*
|
|
153
|
-
* For example, a *Huawei* device will show the *Battery->Launch* screen:
|
|
154
|
-
*
|
|
155
|
-
* 
|
|
156
|
-
* 
|
|
157
|
-
*
|
|
158
|
-
* The site [Don't Kill My App](https://dontkillmyapp.com/) provides a comprehensive list of poor Android vendors which throttle background-services that this plugin relies upon.
|
|
159
|
-
*
|
|
160
|
-
* `showPowerManager` does **not** immediately redirect to the desired Device settings screen. Instead, it first returns a [[DeviceSettingsRequest]], containing
|
|
161
|
-
* meta-data about the device (`manufacturer`, `model`, `version`), in addition to a flags `seen` and `lastSeenAt`, letting you know if and when you've already shown this screen to the user.
|
|
162
|
-
*
|
|
163
|
-
* Unfortunately, there's no possible way to determine if the user *actually* performs the desired action to "white list" your app on the shown settings-screen.
|
|
164
|
-
* For this reason, you'll have to evaluate the provided properties [[DeviceSettingsRequest.seen]] & [[DeviceSettingsRequest.lastSeenAt]] and determine for yourself whether to [[DeviceSettings.show]] this screen.
|
|
165
|
-
*
|
|
166
|
-
* In your success-callback, it's completely **up to you** to instruct the user what exactly to do on that screen, based upon the provided [[DeviceSettingsRequest]] properties `manufacturer`, `model` and `version`.
|
|
167
|
-
*
|
|
168
|
-
* **Note:** Based upon the `manufacturer` / `model` / OS `version`, a Device **may not have** a particular Settings screen implemented (eg: Google Pixel). In this case, the `Promise` will fire an exception.
|
|
169
|
-
*
|
|
170
|
-
* ## Example
|
|
171
|
-
*
|
|
172
|
-
* ```typescript
|
|
173
|
-
* BackgroundGeolocation.deviceSettings.showPowerManager().then((request:DeviceSettingsRequest) => {
|
|
174
|
-
* console.log(`- Screen seen? ${request.seen} ${request.lastSeenAt}`);
|
|
175
|
-
* console.log(`- Device: ${request.manufacturer} ${request.model} ${request.version}`);
|
|
176
|
-
*
|
|
177
|
-
* // If we've already shown this screen to the user, we don't want to annoy them.
|
|
178
|
-
* if (request.seen) {
|
|
179
|
-
* return;
|
|
180
|
-
* }
|
|
181
|
-
* // It's your responsibility to instruct the user what exactly
|
|
182
|
-
* // to do here, perhaps with a Confirm Dialog:
|
|
183
|
-
* showMyConfirmDialog({
|
|
184
|
-
* title: "Device Power Management",
|
|
185
|
-
* text: "Please white-list the app in your Device's Power Management settings by clicking this then selecting that."
|
|
186
|
-
* }).then((confirmed) => {
|
|
187
|
-
* if (confirmed) {
|
|
188
|
-
* // User clicked [Confirm] button. Execute the redirect to settings screen:
|
|
189
|
-
* BackgroundGeolocation.deviceSettings.show(request);
|
|
190
|
-
* }
|
|
191
|
-
* });
|
|
192
|
-
* }).catch((error) => {
|
|
193
|
-
* // Depending on Manufacturer/Model/OS Version, a Device may not implement
|
|
194
|
-
* // a particular Settings screen.
|
|
195
|
-
* console.log(error);
|
|
196
|
-
* });
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* ## Vendor Settings Screens
|
|
200
|
-
*
|
|
201
|
-
* The following Android Settings screen will be shown depending on Vendor / OS version:
|
|
202
|
-
*
|
|
203
|
-
* | Vendor | Settings Activity Name |
|
|
204
|
-
* |--------------------------------------|------------------------------------------------------------------------|
|
|
205
|
-
* | LeEco | `AutobootManageActivity` |
|
|
206
|
-
* | Huawei | `StartupAppControlActivity`,`StartupAppControlActivity` (depends on OS version) |
|
|
207
|
-
* | Color OS | `StartupAppListActivity` |
|
|
208
|
-
* | OPPO | `StartupAppListActivity` |
|
|
209
|
-
* | Vivo | `BgStartUpManagerActivity`,`AddWhiteListActivity`,`BgStartUpManager` (depends on OS version)|
|
|
210
|
-
* | Samsung | `BatteryActivity` |
|
|
211
|
-
* | HTC | `LandingPageActivity` |
|
|
212
|
-
* | Asus | `AutobootManageActivity` |
|
|
213
|
-
* | LeEco | `mobilemanager.MainActivity` |
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
showPowerManager():Promise<DeviceSettingsRequest>;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* This method is designed to be executed from a [[showPowerManager]] or [[showIgnoreBatteryOptimizations]] callback.
|
|
220
|
-
*/
|
|
221
|
-
show(request:DeviceSettingsRequest):Promise<boolean>;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* The Background Geolocation SDK implements the native iOS and Android Geofencing APIs.
|
|
4
|
-
*
|
|
5
|
-
* __ℹ️ Note:__
|
|
6
|
-
* - Native iOS & Android API support only *circular* geofences.
|
|
7
|
-
* - The minimum reliable [[radius]] is `200` meters.
|
|
8
|
-
* - Geofence monitoring *requires* the user authorize [[locationAuthorizationRequest]] **`Always`** — **`When in Use`** will **not** work.
|
|
9
|
-
*
|
|
10
|
-
* ## Adding Geofences
|
|
11
|
-
*
|
|
12
|
-
* Adding a single geofence with [[addGeofence]].
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* BackgroundGeolocation.addGeofence({
|
|
16
|
-
* identifier: "Home",
|
|
17
|
-
* radius: 200,
|
|
18
|
-
* latitude: 45.51921926,
|
|
19
|
-
* longitude: -73.61678581,
|
|
20
|
-
* notifyOnEntry: true,
|
|
21
|
-
* notifyOnExit: true,
|
|
22
|
-
* extras: {
|
|
23
|
-
* route_id: 1234
|
|
24
|
-
* }
|
|
25
|
-
* }).then((success) => {
|
|
26
|
-
* console.log("[addGeofence] success");
|
|
27
|
-
* }).catch((error) => {
|
|
28
|
-
* console.log("[addGeofence] FAILURE: ", error);
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* Adding multiple geofences with [[addGeofences]].
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* BackgroundGeolocation.addGeofences([{
|
|
36
|
-
* identifier: "Home",
|
|
37
|
-
* radius: 200,
|
|
38
|
-
* latitude: 45.51921926,
|
|
39
|
-
* longitude: -73.61678581,
|
|
40
|
-
* notifyOnEntry: true,
|
|
41
|
-
* }, {
|
|
42
|
-
* identifier: "Work",
|
|
43
|
-
* radius: 200,
|
|
44
|
-
* latitude: 45.61921927,
|
|
45
|
-
* longitude: -73.71678582,
|
|
46
|
-
* notifyOnEntry: true
|
|
47
|
-
* }]).then((success) => {
|
|
48
|
-
* console.log("[addGeofences] success");
|
|
49
|
-
* }).catch((error) => {
|
|
50
|
-
* console.log("[addGeofences] FAILURE: ", error);
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* __ℹ️ Note:__ Adding a geofence having an [[identifier]] which already exists within the SDK geofence database will cause the previous record to be destroyed and the new one inserted.
|
|
55
|
-
*
|
|
56
|
-
* ---------------------------------------------------------------------------------------------------
|
|
57
|
-
*
|
|
58
|
-
* ## Listening for Geofence Events
|
|
59
|
-
*
|
|
60
|
-
* Listen to geofence events with [[BackgroundGeolocation.onGeofence]].
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* // Listen for geofence events.
|
|
65
|
-
* BackgroundGeolocation.onGeofence(geofence => {
|
|
66
|
-
* console.log("[geofence] ", geofence.identifier, geofence.action);
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* ---------------------------------------------------------------------------------------------------
|
|
71
|
-
*
|
|
72
|
-
* ## Infinite Geofencing
|
|
73
|
-
*
|
|
74
|
-
* The Background Geolocation SDK contains unique and powerful Geofencing features that allow you to monitor any number of circular geofences you wish (thousands even), in spite of limits imposed by the native platform APIs (**20 for iOS; 100 for Android**).
|
|
75
|
-
*
|
|
76
|
-
* The SDK achieves this by storing your geofences in its database, using a [geospatial query](https://en.wikipedia.org/wiki/Spatial_query) to determine those geofences in proximity ([[geofenceProximityRadius]]), activating only those geofences closest to the device's current location (according the limit imposed by the corresponding platform).
|
|
77
|
-
*
|
|
78
|
-
* - When the device is determined to be moving, the plugin periodically queries for geofences within the [[geofenceProximityRadius]] (eg. every minute) using the latest recorded location. This geospatial query is **very fast**, even with tens-of-thousands geofences in the database.
|
|
79
|
-
* - The SDK **enforces** a *minimum* [[geofenceProximityRadius]] of `1000` meters.
|
|
80
|
-
* - In the following image, the *green* geofences within [[geofenceProximityRadius]] are *actively* monitored. The *grey* geofences outside [[geofenceProximityRadius]] still exist within the SDK's database but are *not* actively being monitored.
|
|
81
|
-
*
|
|
82
|
-
* 
|
|
83
|
-
*
|
|
84
|
-
* ---------------------------------------------------------------------------------------------------
|
|
85
|
-
*
|
|
86
|
-
* ## Listening for changes in the actively-monitored set-of-geofences.
|
|
87
|
-
*
|
|
88
|
-
* As the SDK periodically queries for geofences within the [[geofenceProximityRadius]], you can listen for changes in the actively-monitored geofences using the event [[onGeofencesChange]]. This event will let you know those geofences which have *begun* to be *actively monitored* ([[GeofencesChangeEvent.on]]) in addition to those which just *ceased* to be actively monitored ([[GeofencesChangeEvent.off]]).
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* BackgroundGeolocation.onGeofencesChange((event) => {
|
|
93
|
-
* let on = event.on; //<-- new geofences activated.
|
|
94
|
-
* let off = event.off; //<-- geofences that were just de-activated.
|
|
95
|
-
*
|
|
96
|
-
* // Create map circles
|
|
97
|
-
* on.forEach((geofence) => {
|
|
98
|
-
* createGeofenceMarker(geofence)
|
|
99
|
-
* });
|
|
100
|
-
*
|
|
101
|
-
* // Remove map circles
|
|
102
|
-
* off.forEach((identifier) => {
|
|
103
|
-
* removeGeofenceMarker(identifier);
|
|
104
|
-
* }
|
|
105
|
-
* });
|
|
106
|
-
* ```
|
|
107
|
-
* ### ⚠️ Note:
|
|
108
|
-
* - When **all** geofences have been removed, the [[GeofencesChangeEvent]] will provide empty lists for both [[GeofencesChangeEvent.on]] & [[GeofencesChangeEvent.off]].
|
|
109
|
-
*
|
|
110
|
-
* ---------------------------------------------------------------------------------------------------
|
|
111
|
-
*
|
|
112
|
-
* ## Removing Geofences
|
|
113
|
-
*
|
|
114
|
-
* Once a geofence has been inserted into the SDK's database using [[addGeofence]] or [[addGeofences]], they will be monitored *forever*. If you've configured [[stopOnTerminate]] __`false`__ and [[startOnBoot]] __`true`__, geofences will continue to be monitored even if the application is terminated or device rebooted.
|
|
115
|
-
* To cease monitoring a geofence or *geofences*, you must *remove* them from the SDK's database.
|
|
116
|
-
*
|
|
117
|
-
* - Removing a single geofence by [[identifier]] with [[removeGeofence]]:
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* BackgroundGeolocation.removeGeofence("HOME").then(success => {
|
|
121
|
-
* console.log("[removeGeofence] success");
|
|
122
|
-
* })
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* - Removing *all* geofences with [[removeGeofences]]:
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* BackgroundGeolocation.removeGeofences().then(success => {
|
|
129
|
-
* console.log("[removeGeofences] all geofences have been destroyed");
|
|
130
|
-
* })
|
|
131
|
-
* ```
|
|
132
|
-
* ---------------------------------------------------------------------------------------------------
|
|
133
|
-
*
|
|
134
|
-
* ## Querying Geofences
|
|
135
|
-
*
|
|
136
|
-
* Use the method [[getGeofences]] to retrieve the entire Array of [[Geofence]] stored in the SDK's database.
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```typescript
|
|
140
|
-
* BackgroundGeolocation.getGeofences().then(geofences => {
|
|
141
|
-
* console.log("[getGeofences] ", geofences);
|
|
142
|
-
* })
|
|
143
|
-
* ```
|
|
144
|
-
*
|
|
145
|
-
* ---------------------------------------------------------------------------------------------------
|
|
146
|
-
*
|
|
147
|
-
* ## Monitoring *only* geofences
|
|
148
|
-
*
|
|
149
|
-
* The BackgroundGeolocation SDK allows you to optionally monitor *only* geofences without constant location-tracking. To engage *geofences-only* mode, use the method [[startGeofences]] instead of [[start]].
|
|
150
|
-
*
|
|
151
|
-
* Use option [[Config.geofenceModeHighAccuracy]]:true to improve the responsiveness of geofence events.
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```typescript
|
|
155
|
-
* BackgroundGeolocation.onGeofence(geofence => {
|
|
156
|
-
* console.log("[geofence] ", geofence);
|
|
157
|
-
* })
|
|
158
|
-
*
|
|
159
|
-
* BackgroundGeolocation.ready({
|
|
160
|
-
* url: "http://your.server.com/geofences",
|
|
161
|
-
* autoSync: true,
|
|
162
|
-
* geofenceModeHighAccuracy: true // <-- consumes more power; default is false.
|
|
163
|
-
* }, state => {
|
|
164
|
-
* // engage geofences-only mode:
|
|
165
|
-
* BackgroundGeolocation.startGeofences();
|
|
166
|
-
* })
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* ## Toggling between tracking-modes [[start]] and [[startGeofences]]
|
|
170
|
-
*
|
|
171
|
-
* The SDK can easily be toggled between [[State.trackingMode]] simply by executing the corresponding [[start]] or [[startGeofences]] methods.
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* // Listen to geofence events
|
|
176
|
-
* BackgroundGeolocation.onGeofence(geofence => {
|
|
177
|
-
* console.log("[geofence] ", geofence);
|
|
178
|
-
* if (geofence.identifier == "DANGER_ZONE") {
|
|
179
|
-
* if (geofence.action == "ENTER") {
|
|
180
|
-
* // Entering the danger-zone, we want to aggressively track location.
|
|
181
|
-
* BackgroundGeolocation.start();
|
|
182
|
-
* } else if (geofence.action == "EXIT") {
|
|
183
|
-
* // Exiting the danger-zone, we resume geofences-only tracking.
|
|
184
|
-
* BackgroundGeolocation.startGeofences();
|
|
185
|
-
* }
|
|
186
|
-
* }
|
|
187
|
-
* })
|
|
188
|
-
*
|
|
189
|
-
* // Add a geofence.
|
|
190
|
-
* BackgroundGeolocation.addGeofence({
|
|
191
|
-
* identifier: "DANGER_ZONE",
|
|
192
|
-
* radius: 1000,
|
|
193
|
-
* latitude: 45.51921926,
|
|
194
|
-
* longitude: -73.61678581,
|
|
195
|
-
* notifyOnEntry: true,
|
|
196
|
-
* notifyOnExit: true,
|
|
197
|
-
* })
|
|
198
|
-
*
|
|
199
|
-
* // Ready the plugin.
|
|
200
|
-
* BackgroundGeolocation.ready({
|
|
201
|
-
* desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
|
|
202
|
-
* distanceFilter: 10,
|
|
203
|
-
* url: "http://your.server.com/locations",
|
|
204
|
-
* autoSync: true
|
|
205
|
-
* }, state => {
|
|
206
|
-
* BackgroundGeolocation.startGeofences();
|
|
207
|
-
* })
|
|
208
|
-
* ```
|
|
209
|
-
*
|
|
210
|
-
*/
|
|
211
|
-
interface Geofence {
|
|
212
|
-
/**
|
|
213
|
-
* Unique geofence identifier.
|
|
214
|
-
*/
|
|
215
|
-
identifier: string;
|
|
216
|
-
/**
|
|
217
|
-
* Radius of the circular geofence.
|
|
218
|
-
*
|
|
219
|
-
* ⚠️ The minimum reliable `radius` is __`200`__ meters. Anything less will likely not cause a geofence to trigger. This is documented by Apple [here](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html):
|
|
220
|
-
* > *"The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if WiFi is disabled, region monitoring is significantly less accurate. However, for testing purposes, __you can assume that the minimum distance is approximately 200 meters__*".
|
|
221
|
-
*/
|
|
222
|
-
radius: number;
|
|
223
|
-
/**
|
|
224
|
-
* Latitude of geofence center
|
|
225
|
-
*/
|
|
226
|
-
latitude: number;
|
|
227
|
-
/**
|
|
228
|
-
* Longitude of geofence center.
|
|
229
|
-
*/
|
|
230
|
-
longitude: number;
|
|
231
|
-
/**
|
|
232
|
-
* Set `true` to fire event when device *enters* this geofence.
|
|
233
|
-
*
|
|
234
|
-
* __ℹ️ See also:__
|
|
235
|
-
* - [[Config.geofenceInitialTriggerEntry]]
|
|
236
|
-
*/
|
|
237
|
-
notifyOnEntry?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Set `true` to fire event when device *exits* this geofence.
|
|
240
|
-
*/
|
|
241
|
-
notifyOnExit?: boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Set `true` to fire event when device "loiters" within this geofence for [[loiteringDelay]] milliseconds.
|
|
244
|
-
*/
|
|
245
|
-
notifyOnDwell?: boolean;
|
|
246
|
-
/**
|
|
247
|
-
* Minimum time in *milliseconds* the device must "loiter" within this geofence before [[notifyOnDwell]] event fires.
|
|
248
|
-
*/
|
|
249
|
-
loiteringDelay?: number;
|
|
250
|
-
/**
|
|
251
|
-
* Arbitrary key-values appended to the geofence event and posted to your configured [[Config.url]].
|
|
252
|
-
*/
|
|
253
|
-
extras?: Extras;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* The event-object provided to [[BackgroundGeolocation.onGeofence]] when a geofence transition event occurs.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* BackgroundGeolocation.onGeofence(geofenceEvent => {
|
|
8
|
-
* console.log("[geofence] ", geofenceEvent.identifier, geofence.action, geofenceEvent.location);
|
|
9
|
-
* });
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
interface GeofenceEvent {
|
|
13
|
-
/**
|
|
14
|
-
* The identifier of the geofence which fired.
|
|
15
|
-
*/
|
|
16
|
-
identifier: string;
|
|
17
|
-
/**
|
|
18
|
-
* The transition type: `ENTER`, `EXIT`, `DWELL`
|
|
19
|
-
*/
|
|
20
|
-
action: string;
|
|
21
|
-
/**
|
|
22
|
-
* The [[Location]] where the geofence transition occurred.
|
|
23
|
-
*/
|
|
24
|
-
location: Location;
|
|
25
|
-
/**
|
|
26
|
-
* Optional [[Geofence.extras]]
|
|
27
|
-
*/
|
|
28
|
-
extras?: Extras;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference path="./Geofence.d.ts" />
|
|
2
|
-
///
|
|
3
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
4
|
-
/**
|
|
5
|
-
* The event-object provided to [[BackgroundGeolocation.onGeofencesChange]].
|
|
6
|
-
*
|
|
7
|
-
* The [[GeofencesChangeEvent]] provides only the *changed* geofences, those which just activated or de-activated.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* BackgroundGeolocation.onGeofencesChange(geofencesChangeEvent => {
|
|
12
|
-
* console.log("[geofenceschange] ", geofencesChangeEvent.on, geofencesChangeEvent.off);
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
* ### ⚠️ Note:
|
|
16
|
-
* - When **all** geofences have been removed, empty lists will be provided for both [[on]] & [[off]].
|
|
17
|
-
*/
|
|
18
|
-
interface GeofencesChangeEvent {
|
|
19
|
-
on: Array<Geofence>;
|
|
20
|
-
off: Array<string>;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare module "@transistorsoft/capacitor-background-geolocation" {
|
|
2
|
-
/**
|
|
3
|
-
* The event-object provided to [[BackgroundGeolocation.onHeartbeat]]
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* BackgroundGeolocation.onHeartbeat(heartbeatEvent => {
|
|
8
|
-
* console.log("[heartbeat] ", heartbeatEvent);
|
|
9
|
-
* });
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
interface HeartbeatEvent {
|
|
13
|
-
/**
|
|
14
|
-
* The last-known location.
|
|
15
|
-
* ### ⚠️ Note:
|
|
16
|
-
* - The *heartbeat* event does not actively engage location-services. If you wish to get the current location in your `callback`, use [[getCurrentPosition]].
|
|
17
|
-
*/
|
|
18
|
-
location: Location;
|
|
19
|
-
}
|
|
20
|
-
}
|