@capgo/background-geolocation 7.0.5

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/dist/docs.json ADDED
@@ -0,0 +1,421 @@
1
+ {
2
+ "api": {
3
+ "name": "BackgroundGeolocationPlugin",
4
+ "slug": "backgroundgeolocationplugin",
5
+ "docs": "Main plugin interface for background geolocation functionality.\nProvides methods to manage location watchers and access device settings.",
6
+ "tags": [
7
+ {
8
+ "text": "1.0.0",
9
+ "name": "since"
10
+ }
11
+ ],
12
+ "methods": [
13
+ {
14
+ "name": "addWatcher",
15
+ "signature": "(options: WatcherOptions, callback: (position?: Location | undefined, error?: CallbackError | undefined) => void) => Promise<string>",
16
+ "parameters": [
17
+ {
18
+ "name": "options",
19
+ "docs": "The watcher configuration options",
20
+ "type": "WatcherOptions"
21
+ },
22
+ {
23
+ "name": "callback",
24
+ "docs": "The callback function invoked when a new location is available or an error occurs",
25
+ "type": "(position?: Location | undefined, error?: CallbackError | undefined) => void"
26
+ }
27
+ ],
28
+ "returns": "Promise<string>",
29
+ "tags": [
30
+ {
31
+ "name": "param",
32
+ "text": "options The watcher configuration options"
33
+ },
34
+ {
35
+ "name": "param",
36
+ "text": "callback The callback function invoked when a new location is available or an error occurs"
37
+ },
38
+ {
39
+ "name": "returns",
40
+ "text": "A promise that resolves to a unique identifier for the watcher ID"
41
+ },
42
+ {
43
+ "name": "since",
44
+ "text": "1.0.0"
45
+ },
46
+ {
47
+ "name": "example",
48
+ "text": "const watcherId = await BackgroundGeolocation.addWatcher(\n {\n backgroundMessage: \"App is using your location in the background\",\n backgroundTitle: \"Location Service\",\n requestPermissions: true,\n stale: false,\n distanceFilter: 10\n },\n (location, error) => {\n if (error) {\n console.error('Location error:', error);\n return;\n }\n if (location) {\n console.log('New location:', location.latitude, location.longitude);\n }\n }\n);"
49
+ }
50
+ ],
51
+ "docs": "Adds a watcher for location updates.\nThe watcher will be invoked with the latest location whenever it is available.\nIf an error occurs, the callback will be invoked with the error.",
52
+ "complexTypes": [
53
+ "WatcherOptions",
54
+ "Location",
55
+ "CallbackError"
56
+ ],
57
+ "slug": "addwatcher"
58
+ },
59
+ {
60
+ "name": "removeWatcher",
61
+ "signature": "(options: { id: string; }) => Promise<void>",
62
+ "parameters": [
63
+ {
64
+ "name": "options",
65
+ "docs": "Object containing the watcher ID to remove",
66
+ "type": "{ id: string; }"
67
+ }
68
+ ],
69
+ "returns": "Promise<void>",
70
+ "tags": [
71
+ {
72
+ "name": "param",
73
+ "text": "options Object containing the watcher ID to remove"
74
+ },
75
+ {
76
+ "name": "returns",
77
+ "text": "A promise that resolves when the watcher is successfully removed"
78
+ },
79
+ {
80
+ "name": "since",
81
+ "text": "1.0.0"
82
+ },
83
+ {
84
+ "name": "example",
85
+ "text": "await BackgroundGeolocation.removeWatcher({ id: watcherId });"
86
+ }
87
+ ],
88
+ "docs": "Removes a watcher by its unique identifier.\nStops location updates for the specified watcher.",
89
+ "complexTypes": [],
90
+ "slug": "removewatcher"
91
+ },
92
+ {
93
+ "name": "openSettings",
94
+ "signature": "() => Promise<void>",
95
+ "parameters": [],
96
+ "returns": "Promise<void>",
97
+ "tags": [
98
+ {
99
+ "name": "returns",
100
+ "text": "A promise that resolves when the settings page is opened"
101
+ },
102
+ {
103
+ "name": "since",
104
+ "text": "1.0.0"
105
+ },
106
+ {
107
+ "name": "example",
108
+ "text": "// Direct user to location settings\nawait BackgroundGeolocation.openSettings();"
109
+ }
110
+ ],
111
+ "docs": "Opens the device's location settings page.\nUseful for directing users to enable location services or adjust permissions.",
112
+ "complexTypes": [],
113
+ "slug": "opensettings"
114
+ }
115
+ ],
116
+ "properties": []
117
+ },
118
+ "interfaces": [
119
+ {
120
+ "name": "WatcherOptions",
121
+ "slug": "watcheroptions",
122
+ "docs": "The options for configuring a watcher that listens for location updates.",
123
+ "tags": [
124
+ {
125
+ "text": "1.0.0",
126
+ "name": "since"
127
+ }
128
+ ],
129
+ "methods": [],
130
+ "properties": [
131
+ {
132
+ "name": "backgroundMessage",
133
+ "tags": [
134
+ {
135
+ "text": "1.0.0",
136
+ "name": "since"
137
+ },
138
+ {
139
+ "text": "\"Getting your location to provide better service\"",
140
+ "name": "example"
141
+ }
142
+ ],
143
+ "docs": "If the \"backgroundMessage\" option is defined, the watcher will\nprovide location updates whether the app is in the background or the\nforeground. If it is not defined, location updates are only\nguaranteed in the foreground. This is true on both platforms.\n\nOn Android, a notification must be shown to continue receiving\nlocation updates in the background. This option specifies the text of\nthat notification.",
144
+ "complexTypes": [],
145
+ "type": "string | undefined"
146
+ },
147
+ {
148
+ "name": "backgroundTitle",
149
+ "tags": [
150
+ {
151
+ "text": "1.0.0",
152
+ "name": "since"
153
+ },
154
+ {
155
+ "text": "\"Using your location\"",
156
+ "name": "default"
157
+ },
158
+ {
159
+ "text": "\"Location Service\"",
160
+ "name": "example"
161
+ }
162
+ ],
163
+ "docs": "The title of the notification mentioned above.",
164
+ "complexTypes": [],
165
+ "type": "string | undefined"
166
+ },
167
+ {
168
+ "name": "requestPermissions",
169
+ "tags": [
170
+ {
171
+ "text": "1.0.0",
172
+ "name": "since"
173
+ },
174
+ {
175
+ "text": "true",
176
+ "name": "default"
177
+ },
178
+ {
179
+ "text": "// Auto-request permissions\nrequestPermissions: true\n\n// Don't auto-request, handle manually\nrequestPermissions: false",
180
+ "name": "example"
181
+ }
182
+ ],
183
+ "docs": "Whether permissions should be requested from the user automatically,\nif they are not already granted.",
184
+ "complexTypes": [],
185
+ "type": "boolean | undefined"
186
+ },
187
+ {
188
+ "name": "stale",
189
+ "tags": [
190
+ {
191
+ "text": "1.0.0",
192
+ "name": "since"
193
+ },
194
+ {
195
+ "text": "false",
196
+ "name": "default"
197
+ },
198
+ {
199
+ "text": "// Allow stale locations for faster initial response\nstale: true\n\n// Only fresh locations\nstale: false",
200
+ "name": "example"
201
+ }
202
+ ],
203
+ "docs": "If \"true\", stale locations may be delivered while the device\nobtains a GPS fix. You are responsible for checking the \"time\"\nproperty. If \"false\", locations are guaranteed to be up to date.",
204
+ "complexTypes": [],
205
+ "type": "boolean | undefined"
206
+ },
207
+ {
208
+ "name": "distanceFilter",
209
+ "tags": [
210
+ {
211
+ "text": "1.0.0",
212
+ "name": "since"
213
+ },
214
+ {
215
+ "text": "0",
216
+ "name": "default"
217
+ },
218
+ {
219
+ "text": "// Update every 10 meters\ndistanceFilter: 10\n\n// Update on any movement\ndistanceFilter: 0",
220
+ "name": "example"
221
+ }
222
+ ],
223
+ "docs": "The distance in meters that the device must move before a new location update is triggered.\nThis is used to filter out small movements and reduce the number of updates.",
224
+ "complexTypes": [],
225
+ "type": "number | undefined"
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "name": "Location",
231
+ "slug": "location",
232
+ "docs": "Represents a geographical location with various attributes.\nContains all the standard location properties returned by GPS/network providers.",
233
+ "tags": [
234
+ {
235
+ "text": "1.0.0",
236
+ "name": "since"
237
+ }
238
+ ],
239
+ "methods": [],
240
+ "properties": [
241
+ {
242
+ "name": "latitude",
243
+ "tags": [
244
+ {
245
+ "text": "1.0.0",
246
+ "name": "since"
247
+ },
248
+ {
249
+ "text": "40.7128",
250
+ "name": "example"
251
+ }
252
+ ],
253
+ "docs": "Latitude in degrees.\nRange: -90.0 to +90.0",
254
+ "complexTypes": [],
255
+ "type": "number"
256
+ },
257
+ {
258
+ "name": "longitude",
259
+ "tags": [
260
+ {
261
+ "text": "1.0.0",
262
+ "name": "since"
263
+ },
264
+ {
265
+ "text": "-74.0060",
266
+ "name": "example"
267
+ }
268
+ ],
269
+ "docs": "Longitude in degrees.\nRange: -180.0 to +180.0",
270
+ "complexTypes": [],
271
+ "type": "number"
272
+ },
273
+ {
274
+ "name": "accuracy",
275
+ "tags": [
276
+ {
277
+ "text": "1.0.0",
278
+ "name": "since"
279
+ },
280
+ {
281
+ "text": "5.0",
282
+ "name": "example"
283
+ }
284
+ ],
285
+ "docs": "Radius of horizontal uncertainty in metres, with 68% confidence.\nLower values indicate more accurate location.",
286
+ "complexTypes": [],
287
+ "type": "number"
288
+ },
289
+ {
290
+ "name": "altitude",
291
+ "tags": [
292
+ {
293
+ "text": "1.0.0",
294
+ "name": "since"
295
+ },
296
+ {
297
+ "text": "10.5",
298
+ "name": "example"
299
+ }
300
+ ],
301
+ "docs": "Metres above sea level (or null if not available).",
302
+ "complexTypes": [],
303
+ "type": "number | null"
304
+ },
305
+ {
306
+ "name": "altitudeAccuracy",
307
+ "tags": [
308
+ {
309
+ "text": "1.0.0",
310
+ "name": "since"
311
+ },
312
+ {
313
+ "text": "3.0",
314
+ "name": "example"
315
+ }
316
+ ],
317
+ "docs": "Vertical uncertainty in metres, with 68% confidence (or null if not available).",
318
+ "complexTypes": [],
319
+ "type": "number | null"
320
+ },
321
+ {
322
+ "name": "simulated",
323
+ "tags": [
324
+ {
325
+ "text": "1.0.0",
326
+ "name": "since"
327
+ },
328
+ {
329
+ "text": "false",
330
+ "name": "example"
331
+ }
332
+ ],
333
+ "docs": "`true` if the location was simulated by software, rather than GPS.\nUseful for detecting mock locations in development or testing.",
334
+ "complexTypes": [],
335
+ "type": "boolean"
336
+ },
337
+ {
338
+ "name": "bearing",
339
+ "tags": [
340
+ {
341
+ "text": "1.0.0",
342
+ "name": "since"
343
+ },
344
+ {
345
+ "text": "45.5",
346
+ "name": "example"
347
+ }
348
+ ],
349
+ "docs": "Deviation from true north in degrees (or null if not available).\nRange: 0.0 to 360.0",
350
+ "complexTypes": [],
351
+ "type": "number | null"
352
+ },
353
+ {
354
+ "name": "speed",
355
+ "tags": [
356
+ {
357
+ "text": "1.0.0",
358
+ "name": "since"
359
+ },
360
+ {
361
+ "text": "2.5",
362
+ "name": "example"
363
+ }
364
+ ],
365
+ "docs": "Speed in metres per second (or null if not available).",
366
+ "complexTypes": [],
367
+ "type": "number | null"
368
+ },
369
+ {
370
+ "name": "time",
371
+ "tags": [
372
+ {
373
+ "text": "1.0.0",
374
+ "name": "since"
375
+ },
376
+ {
377
+ "text": "1640995200000",
378
+ "name": "example"
379
+ }
380
+ ],
381
+ "docs": "Time the location was produced, in milliseconds since the unix epoch.\nUse this to check if a location is stale when using stale: true.",
382
+ "complexTypes": [],
383
+ "type": "number | null"
384
+ }
385
+ ]
386
+ },
387
+ {
388
+ "name": "CallbackError",
389
+ "slug": "callbackerror",
390
+ "docs": "Error object that may be passed to the location watcher callback.\nExtends the standard Error with optional error codes.",
391
+ "tags": [
392
+ {
393
+ "text": "1.0.0",
394
+ "name": "since"
395
+ }
396
+ ],
397
+ "methods": [],
398
+ "properties": [
399
+ {
400
+ "name": "code",
401
+ "tags": [
402
+ {
403
+ "text": "1.0.0",
404
+ "name": "since"
405
+ },
406
+ {
407
+ "text": "\"PERMISSION_DENIED\"",
408
+ "name": "example"
409
+ }
410
+ ],
411
+ "docs": "Optional error code for more specific error handling.",
412
+ "complexTypes": [],
413
+ "type": "string | undefined"
414
+ }
415
+ ]
416
+ }
417
+ ],
418
+ "enums": [],
419
+ "typeAliases": [],
420
+ "pluginConfigs": []
421
+ }
@@ -0,0 +1,229 @@
1
+ /**
2
+ * The options for configuring a watcher that listens for location updates.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+ export interface WatcherOptions {
7
+ /**
8
+ * If the "backgroundMessage" option is defined, the watcher will
9
+ * provide location updates whether the app is in the background or the
10
+ * foreground. If it is not defined, location updates are only
11
+ * guaranteed in the foreground. This is true on both platforms.
12
+ *
13
+ * On Android, a notification must be shown to continue receiving
14
+ * location updates in the background. This option specifies the text of
15
+ * that notification.
16
+ *
17
+ * @since 1.0.0
18
+ * @example "Getting your location to provide better service"
19
+ */
20
+ backgroundMessage?: string;
21
+ /**
22
+ * The title of the notification mentioned above.
23
+ *
24
+ * @since 1.0.0
25
+ * @default "Using your location"
26
+ * @example "Location Service"
27
+ */
28
+ backgroundTitle?: string;
29
+ /**
30
+ * Whether permissions should be requested from the user automatically,
31
+ * if they are not already granted.
32
+ *
33
+ * @since 1.0.0
34
+ * @default true
35
+ * @example
36
+ * // Auto-request permissions
37
+ * requestPermissions: true
38
+ *
39
+ * // Don't auto-request, handle manually
40
+ * requestPermissions: false
41
+ */
42
+ requestPermissions?: boolean;
43
+ /**
44
+ * If "true", stale locations may be delivered while the device
45
+ * obtains a GPS fix. You are responsible for checking the "time"
46
+ * property. If "false", locations are guaranteed to be up to date.
47
+ *
48
+ * @since 1.0.0
49
+ * @default false
50
+ * @example
51
+ * // Allow stale locations for faster initial response
52
+ * stale: true
53
+ *
54
+ * // Only fresh locations
55
+ * stale: false
56
+ */
57
+ stale?: boolean;
58
+ /**
59
+ * The distance in meters that the device must move before a new location update is triggered.
60
+ * This is used to filter out small movements and reduce the number of updates.
61
+ *
62
+ * @since 1.0.0
63
+ * @default 0
64
+ * @example
65
+ * // Update every 10 meters
66
+ * distanceFilter: 10
67
+ *
68
+ * // Update on any movement
69
+ * distanceFilter: 0
70
+ */
71
+ distanceFilter?: number;
72
+ }
73
+ /**
74
+ * Represents a geographical location with various attributes.
75
+ * Contains all the standard location properties returned by GPS/network providers.
76
+ *
77
+ * @since 1.0.0
78
+ */
79
+ export interface Location {
80
+ /**
81
+ * Latitude in degrees.
82
+ * Range: -90.0 to +90.0
83
+ *
84
+ * @since 1.0.0
85
+ * @example 40.7128
86
+ */
87
+ latitude: number;
88
+ /**
89
+ * Longitude in degrees.
90
+ * Range: -180.0 to +180.0
91
+ *
92
+ * @since 1.0.0
93
+ * @example -74.0060
94
+ */
95
+ longitude: number;
96
+ /**
97
+ * Radius of horizontal uncertainty in metres, with 68% confidence.
98
+ * Lower values indicate more accurate location.
99
+ *
100
+ * @since 1.0.0
101
+ * @example 5.0
102
+ */
103
+ accuracy: number;
104
+ /**
105
+ * Metres above sea level (or null if not available).
106
+ *
107
+ * @since 1.0.0
108
+ * @example 10.5
109
+ */
110
+ altitude: number | null;
111
+ /**
112
+ * Vertical uncertainty in metres, with 68% confidence (or null if not available).
113
+ *
114
+ * @since 1.0.0
115
+ * @example 3.0
116
+ */
117
+ altitudeAccuracy: number | null;
118
+ /**
119
+ * `true` if the location was simulated by software, rather than GPS.
120
+ * Useful for detecting mock locations in development or testing.
121
+ *
122
+ * @since 1.0.0
123
+ * @example false
124
+ */
125
+ simulated: boolean;
126
+ /**
127
+ * Deviation from true north in degrees (or null if not available).
128
+ * Range: 0.0 to 360.0
129
+ *
130
+ * @since 1.0.0
131
+ * @example 45.5
132
+ */
133
+ bearing: number | null;
134
+ /**
135
+ * Speed in metres per second (or null if not available).
136
+ *
137
+ * @since 1.0.0
138
+ * @example 2.5
139
+ */
140
+ speed: number | null;
141
+ /**
142
+ * Time the location was produced, in milliseconds since the unix epoch.
143
+ * Use this to check if a location is stale when using stale: true.
144
+ *
145
+ * @since 1.0.0
146
+ * @example 1640995200000
147
+ */
148
+ time: number | null;
149
+ }
150
+ /**
151
+ * Error object that may be passed to the location watcher callback.
152
+ * Extends the standard Error with optional error codes.
153
+ *
154
+ * @since 1.0.0
155
+ */
156
+ export interface CallbackError extends Error {
157
+ /**
158
+ * Optional error code for more specific error handling.
159
+ *
160
+ * @since 1.0.0
161
+ * @example "PERMISSION_DENIED"
162
+ */
163
+ code?: string;
164
+ }
165
+ /**
166
+ * Main plugin interface for background geolocation functionality.
167
+ * Provides methods to manage location watchers and access device settings.
168
+ *
169
+ * @since 1.0.0
170
+ */
171
+ export interface BackgroundGeolocationPlugin {
172
+ /**
173
+ * Adds a watcher for location updates.
174
+ * The watcher will be invoked with the latest location whenever it is available.
175
+ * If an error occurs, the callback will be invoked with the error.
176
+ *
177
+ * @param options The watcher configuration options
178
+ * @param callback The callback function invoked when a new location is available or an error occurs
179
+ * @returns A promise that resolves to a unique identifier for the watcher ID
180
+ *
181
+ * @since 1.0.0
182
+ * @example
183
+ * const watcherId = await BackgroundGeolocation.addWatcher(
184
+ * {
185
+ * backgroundMessage: "App is using your location in the background",
186
+ * backgroundTitle: "Location Service",
187
+ * requestPermissions: true,
188
+ * stale: false,
189
+ * distanceFilter: 10
190
+ * },
191
+ * (location, error) => {
192
+ * if (error) {
193
+ * console.error('Location error:', error);
194
+ * return;
195
+ * }
196
+ * if (location) {
197
+ * console.log('New location:', location.latitude, location.longitude);
198
+ * }
199
+ * }
200
+ * );
201
+ */
202
+ addWatcher(options: WatcherOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<string>;
203
+ /**
204
+ * Removes a watcher by its unique identifier.
205
+ * Stops location updates for the specified watcher.
206
+ *
207
+ * @param options Object containing the watcher ID to remove
208
+ * @returns A promise that resolves when the watcher is successfully removed
209
+ *
210
+ * @since 1.0.0
211
+ * @example
212
+ * await BackgroundGeolocation.removeWatcher({ id: watcherId });
213
+ */
214
+ removeWatcher(options: {
215
+ id: string;
216
+ }): Promise<void>;
217
+ /**
218
+ * Opens the device's location settings page.
219
+ * Useful for directing users to enable location services or adjust permissions.
220
+ *
221
+ * @returns A promise that resolves when the settings page is opened
222
+ *
223
+ * @since 1.0.0
224
+ * @example
225
+ * // Direct user to location settings
226
+ * await BackgroundGeolocation.openSettings();
227
+ */
228
+ openSettings(): Promise<void>;
229
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The options for configuring a watcher that listens for location updates.\n *\n * @since 1.0.0\n */\nexport interface WatcherOptions {\n /**\n * If the \"backgroundMessage\" option is defined, the watcher will\n * provide location updates whether the app is in the background or the\n * foreground. If it is not defined, location updates are only\n * guaranteed in the foreground. This is true on both platforms.\n *\n * On Android, a notification must be shown to continue receiving\n * location updates in the background. This option specifies the text of\n * that notification.\n *\n * @since 1.0.0\n * @example \"Getting your location to provide better service\"\n */\n backgroundMessage?: string;\n /**\n * The title of the notification mentioned above.\n *\n * @since 1.0.0\n * @default \"Using your location\"\n * @example \"Location Service\"\n */\n backgroundTitle?: string;\n /**\n * Whether permissions should be requested from the user automatically,\n * if they are not already granted.\n *\n * @since 1.0.0\n * @default true\n * @example\n * // Auto-request permissions\n * requestPermissions: true\n *\n * // Don't auto-request, handle manually\n * requestPermissions: false\n */\n requestPermissions?: boolean;\n /**\n * If \"true\", stale locations may be delivered while the device\n * obtains a GPS fix. You are responsible for checking the \"time\"\n * property. If \"false\", locations are guaranteed to be up to date.\n *\n * @since 1.0.0\n * @default false\n * @example\n * // Allow stale locations for faster initial response\n * stale: true\n *\n * // Only fresh locations\n * stale: false\n */\n stale?: boolean;\n /**\n * The distance in meters that the device must move before a new location update is triggered.\n * This is used to filter out small movements and reduce the number of updates.\n *\n * @since 1.0.0\n * @default 0\n * @example\n * // Update every 10 meters\n * distanceFilter: 10\n *\n * // Update on any movement\n * distanceFilter: 0\n */\n distanceFilter?: number;\n}\n\n/**\n * Represents a geographical location with various attributes.\n * Contains all the standard location properties returned by GPS/network providers.\n *\n * @since 1.0.0\n */\nexport interface Location {\n /**\n * Latitude in degrees.\n * Range: -90.0 to +90.0\n *\n * @since 1.0.0\n * @example 40.7128\n */\n latitude: number;\n /**\n * Longitude in degrees.\n * Range: -180.0 to +180.0\n *\n * @since 1.0.0\n * @example -74.0060\n */\n longitude: number;\n /**\n * Radius of horizontal uncertainty in metres, with 68% confidence.\n * Lower values indicate more accurate location.\n *\n * @since 1.0.0\n * @example 5.0\n */\n accuracy: number;\n /**\n * Metres above sea level (or null if not available).\n *\n * @since 1.0.0\n * @example 10.5\n */\n altitude: number | null;\n /**\n * Vertical uncertainty in metres, with 68% confidence (or null if not available).\n *\n * @since 1.0.0\n * @example 3.0\n */\n altitudeAccuracy: number | null;\n /**\n * `true` if the location was simulated by software, rather than GPS.\n * Useful for detecting mock locations in development or testing.\n *\n * @since 1.0.0\n * @example false\n */\n simulated: boolean;\n /**\n * Deviation from true north in degrees (or null if not available).\n * Range: 0.0 to 360.0\n *\n * @since 1.0.0\n * @example 45.5\n */\n bearing: number | null;\n /**\n * Speed in metres per second (or null if not available).\n *\n * @since 1.0.0\n * @example 2.5\n */\n speed: number | null;\n /**\n * Time the location was produced, in milliseconds since the unix epoch.\n * Use this to check if a location is stale when using stale: true.\n *\n * @since 1.0.0\n * @example 1640995200000\n */\n time: number | null;\n}\n\n/**\n * Error object that may be passed to the location watcher callback.\n * Extends the standard Error with optional error codes.\n *\n * @since 1.0.0\n */\nexport interface CallbackError extends Error {\n /**\n * Optional error code for more specific error handling.\n *\n * @since 1.0.0\n * @example \"PERMISSION_DENIED\"\n */\n code?: string;\n}\n\n/**\n * Main plugin interface for background geolocation functionality.\n * Provides methods to manage location watchers and access device settings.\n *\n * @since 1.0.0\n */\nexport interface BackgroundGeolocationPlugin {\n /**\n * Adds a watcher for location updates.\n * The watcher will be invoked with the latest location whenever it is available.\n * If an error occurs, the callback will be invoked with the error.\n *\n * @param options The watcher configuration options\n * @param callback The callback function invoked when a new location is available or an error occurs\n * @returns A promise that resolves to a unique identifier for the watcher ID\n *\n * @since 1.0.0\n * @example\n * const watcherId = await BackgroundGeolocation.addWatcher(\n * {\n * backgroundMessage: \"App is using your location in the background\",\n * backgroundTitle: \"Location Service\",\n * requestPermissions: true,\n * stale: false,\n * distanceFilter: 10\n * },\n * (location, error) => {\n * if (error) {\n * console.error('Location error:', error);\n * return;\n * }\n * if (location) {\n * console.log('New location:', location.latitude, location.longitude);\n * }\n * }\n * );\n */\n addWatcher(\n options: WatcherOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<string>;\n\n /**\n * Removes a watcher by its unique identifier.\n * Stops location updates for the specified watcher.\n *\n * @param options Object containing the watcher ID to remove\n * @returns A promise that resolves when the watcher is successfully removed\n *\n * @since 1.0.0\n * @example\n * await BackgroundGeolocation.removeWatcher({ id: watcherId });\n */\n removeWatcher(options: { id: string }): Promise<void>;\n\n /**\n * Opens the device's location settings page.\n * Useful for directing users to enable location services or adjust permissions.\n *\n * @returns A promise that resolves when the settings page is opened\n *\n * @since 1.0.0\n * @example\n * // Direct user to location settings\n * await BackgroundGeolocation.openSettings();\n */\n openSettings(): Promise<void>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { BackgroundGeolocationPlugin } from "./definitions";
2
+ declare const BackgroundGeolocation: BackgroundGeolocationPlugin;
3
+ export * from "./definitions";
4
+ export { BackgroundGeolocation };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from "@capacitor/core";
2
+ const BackgroundGeolocation = registerPlugin("BackgroundGeolocation", {
3
+ web: () => import("./web").then((m) => new m.BackgroundGeolocationWeb()),
4
+ });
5
+ export * from "./definitions";
6
+ export { BackgroundGeolocation };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,qBAAqB,GAAG,cAAc,CAC1C,uBAAuB,EACvB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;CACzE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\n\nimport type { BackgroundGeolocationPlugin } from \"./definitions\";\n\nconst BackgroundGeolocation = registerPlugin<BackgroundGeolocationPlugin>(\n \"BackgroundGeolocation\",\n {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n },\n);\n\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n"]}