@transistorsoft/background-geolocation-types 5.0.0-beta.2 → 5.0.0-beta.4

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.
Files changed (77) hide show
  1. package/dist/core/api/BackgroundGeolocation.d.ts +115 -359
  2. package/dist/core/api/CurrentPositionRequest.d.ts +0 -36
  3. package/dist/core/api/DeviceSettings.d.ts +0 -63
  4. package/dist/core/api/Logger.d.ts +0 -400
  5. package/dist/core/api/State.d.ts +0 -63
  6. package/dist/core/api/TransistorAuthorizationService.d.ts +0 -110
  7. package/dist/core/config/ActivityConfig.d.ts +0 -260
  8. package/dist/core/config/AppConfig.d.ts +0 -581
  9. package/dist/core/config/AuthorizationConfig.d.ts +0 -191
  10. package/dist/core/config/Config.d.ts +0 -176
  11. package/dist/core/config/GeoConfig.d.ts +0 -876
  12. package/dist/core/config/HttpConfig.d.ts +0 -565
  13. package/dist/core/config/LocationFilter.d.ts +0 -256
  14. package/dist/core/config/LoggerConfig.d.ts +0 -313
  15. package/dist/core/config/NotificationConfig.d.ts +0 -504
  16. package/dist/core/config/PersistenceConfig.d.ts +0 -541
  17. package/dist/core/data/DeviceInfo.d.ts +0 -54
  18. package/dist/core/data/Geofence.d.ts +0 -5
  19. package/dist/core/data/Location.d.ts +0 -213
  20. package/dist/core/data/Sensors.d.ts +0 -22
  21. package/dist/core/events/AuthorizationEvent.d.ts +0 -9
  22. package/dist/core/events/ConnectivityChangeEvent.d.ts +0 -6
  23. package/dist/core/events/GeofenceEvent.d.ts +0 -10
  24. package/dist/core/events/GeofencesChangeEvent.d.ts +0 -7
  25. package/dist/core/events/HeadlessEvent.d.ts +0 -7
  26. package/dist/core/events/HeartbeatEvent.d.ts +0 -10
  27. package/dist/core/events/HttpEvent.d.ts +0 -8
  28. package/dist/core/events/MotionActivityEvent.d.ts +0 -7
  29. package/dist/core/events/MotionChangeEvent.d.ts +0 -7
  30. package/dist/core/events/ProviderChangeEvent.d.ts +0 -10
  31. package/dist/core/events/Subscription.d.ts +0 -83
  32. package/dist/docs-entry.js +0 -3
  33. package/dist/enums/AccuracyAuthorization.d.ts +1 -12
  34. package/dist/enums/AccuracyAuthorization.js +0 -12
  35. package/dist/enums/ActivityType.d.ts +1 -21
  36. package/dist/enums/ActivityType.js +0 -21
  37. package/dist/enums/AuthorizationStatus.d.ts +1 -13
  38. package/dist/enums/AuthorizationStatus.js +0 -13
  39. package/dist/enums/AuthorizationStrategy.d.ts +1 -6
  40. package/dist/enums/AuthorizationStrategy.js +0 -6
  41. package/dist/enums/DesiredAccuracy.d.ts +1 -5
  42. package/dist/enums/DesiredAccuracy.js +0 -5
  43. package/dist/enums/Event.d.ts +1 -5
  44. package/dist/enums/Event.js +0 -5
  45. package/dist/enums/GeofenceAction.d.ts +1 -13
  46. package/dist/enums/GeofenceAction.js +0 -13
  47. package/dist/enums/HttpMethod.d.ts +1 -6
  48. package/dist/enums/HttpMethod.js +0 -6
  49. package/dist/enums/KalmanProfile.d.ts +1 -25
  50. package/dist/enums/KalmanProfile.js +0 -25
  51. package/dist/enums/LocationError.d.ts +1 -15
  52. package/dist/enums/LocationError.js +0 -15
  53. package/dist/enums/LocationFilterPolicy.d.ts +1 -103
  54. package/dist/enums/LocationFilterPolicy.js +0 -103
  55. package/dist/enums/LocationRequest.d.ts +1 -15
  56. package/dist/enums/LocationRequest.js +0 -15
  57. package/dist/enums/LogLevel.d.ts +1 -16
  58. package/dist/enums/LogLevel.js +0 -16
  59. package/dist/enums/LogLevelName.d.ts +8 -1
  60. package/dist/enums/LogLevelName.js +0 -5
  61. package/dist/enums/MotionActivityType.d.ts +1 -5
  62. package/dist/enums/MotionActivityType.js +0 -5
  63. package/dist/enums/NotificationPriority.d.ts +1 -15
  64. package/dist/enums/NotificationPriority.js +0 -15
  65. package/dist/enums/PersistMode.d.ts +1 -6
  66. package/dist/enums/PersistMode.js +0 -6
  67. package/dist/enums/SQLQueryOrder.d.ts +0 -11
  68. package/dist/enums/SQLQueryOrder.js +0 -10
  69. package/dist/enums/TrackingMode.d.ts +1 -10
  70. package/dist/enums/TrackingMode.js +0 -10
  71. package/dist/enums/TriggerActivity.d.ts +1 -6
  72. package/dist/enums/TriggerActivity.js +0 -6
  73. package/dist/index.js +0 -4
  74. package/dist/legacy/LegacyConfig.d.ts +0 -19
  75. package/package.json +8 -9
  76. package/dist/core/config/CompoundConfig.d.ts +0 -19
  77. package/dist/core/config/CompoundConfig.js +0 -2
@@ -1,374 +1,130 @@
1
- /**
2
- * Primary BackgroundGeolocation API
3
- *
4
- * __Overview__
5
- *
6
- * The `BackgroundGeolocation` interface defines the **complete, strongly-typed API surface**
7
- * for Transistor Software’s Background Geolocation SDK.
8
- * This is the main entry-point used by all JavaScript adapters:
9
- *
10
- * - React Native (`{{pluginName}}`)
11
- * - Capacitor
12
- * - Cordova
13
- *
14
- * The API provides:
15
- *
16
- * - **Configuration** via a single {@link Config} object composed of modular
17
- * sub-configs (`GeoConfig`, `HttpConfig`, `PersistenceConfig`, etc)
18
- * - **Lifecycle control** (`ready`, `start`, `stop`, `setConfig`, `reset`)
19
- * - **Location tracking** (motion-based tracking, `getCurrentPosition`,
20
- * `watchPosition`)
21
- * - **Geofencing** (`addGeofence`, `onGeofence`, etc)
22
- * - **Events subsystem** with fully-typed callbacks (`onLocation`,
23
- * `onMotionChange`, `onHttp`, `onProviderChange`, etc)
24
- * - **Native services** such as background-tasks, authorization workflows,
25
- * scheduling, and device-capability checks
26
- * - **Persistence + HTTP** via an internal SQLite buffer and optional
27
- * auto-upload system
28
- *
29
- * __Typed Configuration (Compound Config)__
30
- *
31
- * Instead of a large “flat” configuration object, the SDK uses a
32
- * *compound-configuration model*:
33
- *
34
- * ```ts
35
- * import BackgroundGeolocation, {
36
- * Config,
37
- * GeoConfig,
38
- * HttpConfig
39
- * } from "{{pluginName}}";
40
- *
41
- * const config: Config = {
42
- * geolocation: {
43
- * desiredAccuracy: BackgroundGeolocation.DesiredAccuracy.High,
44
- * distanceFilter: 20
45
- * },
46
- * http: {
47
- * url: "https://example.com/locations",
48
- * autoSync: true
49
- * },
50
- * persistence: {
51
- * maxDaysToPersist: 7
52
- * }
53
- * };
54
- *
55
- * BackgroundGeolocation.ready(config);
56
- * ```
57
- *
58
- * This structure ensures:
59
- *
60
- * - **Clear separation of concerns**
61
- * - **Type-safe configuration**
62
- * - **Automatic backwards-compatibility** with legacy flat keys
63
- *
64
- * __Typed Enum Namespaces__
65
- *
66
- * All configuration flags that were previously “magic constants”
67
- * (e.g., `LOG_LEVEL_VERBOSE`, `DESIRED_ACCURACY_HIGH`) now live in
68
- * strongly-typed namespaces attached to the default export:
69
- *
70
- * - {@link BackgroundGeolocation.LogLevel}
71
- * - {@link BackgroundGeolocation.DesiredAccuracy}
72
- * - {@link BackgroundGeolocation.PersistMode}
73
- * - {@link BackgroundGeolocation.NotificationPriority}
74
- * - {@link BackgroundGeolocation.Event}
75
- * - …and more
76
- *
77
- * These can also be imported individually:
78
- *
79
- * ```ts
80
- * import BackgroundGeolocation, { LogLevel } from "{{pluginName}}";
81
- *
82
- * BackgroundGeolocation.ready({
83
- * logger: {
84
- * logLevel: LogLevel.Debug
85
- * }
86
- * });
87
- * ```
88
- *
89
- * __Event System__
90
- *
91
- * The SDK exposes a robust, typed event API:
92
- *
93
- * ```ts
94
- * BackgroundGeolocation.onLocation((location) => {
95
- * console.log("New location:", location);
96
- * });
97
- *
98
- * BackgroundGeolocation.onMotionChange((event) => {
99
- * console.log("Device is moving?", event.isMoving);
100
- * });
101
- * ```
102
- *
103
- * All events return **Subscription** objects which must be removed when no longer
104
- * needed:
105
- *
106
- * ```ts
107
- * const sub = BackgroundGeolocation.onHttp((e) => { ... });
108
- * sub.remove();
109
- * ```
110
- *
111
- * __Native Lifecycle Requirements__
112
- *
113
- * On both iOS and Android, `BackgroundGeolocation.ready(config)` must be called
114
- * **exactly once per app launch**, before calling `start()`.
115
- * The SDK automatically restores its last-known configuration from persistent
116
- * storage after first install.
117
- *
118
- * __Philosophy of Operation__
119
- *
120
- * Transistorsoft’s tracking engine is built around:
121
- *
122
- * - **Motion-based state transitions** (stationary ↔ moving)
123
- * - **Aggressive tracking only when moving**
124
- * - **Energy-efficient passive monitoring when stationary**
125
- * - **Reliable persistence via SQLite**
126
- * - **Automatic retries + batching** for HTTP uploads
127
- *
128
- * Combined, this enables *battery-efficient*, *high-quality* background tracking
129
- * across iOS and Android.
130
- *
131
- * __Capabilities__
132
- *
133
- * - High-frequency tracking while the device is moving
134
- * - Zero-movement battery preservation
135
- * - Geofence monitoring at scale (thousands of geofences)
136
- * - Offline storage + sync when network is restored
137
- * - Background tasks for long-running operations
138
- * - Authorization state + system diagnostics
139
- *
140
- * __Getting Started__
141
- *
142
- * ```ts
143
- * import BackgroundGeolocation from "{{pluginName}}";
144
- *
145
- * const state = await BackgroundGeolocation.ready({
146
- * geolocation: { distanceFilter: 10 },
147
- * http: { url: "https://example.com/locations", autoSync: true }
148
- * });
149
- *
150
- * if (!state.enabled) {
151
- * await BackgroundGeolocation.start();
152
- * }
153
- * ```
154
- *
155
- * Once `start()` is called, the SDK begins operating according to your
156
- * configuration and continues running—even in the background—until you call
157
- * `stop()`.
158
- *
159
- * @category Primary API
160
- */
1
+ import type { Logger } from './Logger';
2
+ import type { DeviceSettings } from './DeviceSettings';
3
+ import type { CurrentPositionRequest } from './CurrentPositionRequest';
4
+ import type { Config } from '../config/Config';
5
+ import type { State } from './State';
6
+ import type { Location } from '../data/Location';
7
+ import type { LocationError } from '../../enums/LocationError';
8
+ import type { Geofence } from '../data/Geofence';
9
+ import type { DeviceInfo } from '../data/DeviceInfo';
10
+ import type { Sensors } from '../data/Sensors';
11
+ import type { Subscription } from '../events/Subscription';
12
+ import type { GeofenceEvent } from '../events/GeofenceEvent';
13
+ import type { AuthorizationEvent } from '../events/AuthorizationEvent';
14
+ import type { MotionActivityEvent } from '../events/MotionActivityEvent';
15
+ import type { HeadlessEvent } from '../events/HeadlessEvent';
16
+ import type { HeartbeatEvent } from '../events/HeartbeatEvent';
17
+ import type { GeofencesChangeEvent } from '../events/GeofencesChangeEvent';
18
+ import type { ConnectivityChangeEvent } from '../events/ConnectivityChangeEvent';
19
+ import type { MotionChangeEvent } from '../events/MotionChangeEvent';
20
+ import type { ProviderChangeEvent } from '../events/ProviderChangeEvent';
21
+ import type { HttpEvent } from '../events/HttpEvent';
22
+ import type { AuthorizationStatus } from '../../enums/AuthorizationStatus';
23
+ import type { LogLevel } from '../../enums/LogLevel';
24
+ import type { PersistMode } from '../../enums/PersistMode';
25
+ import type { AccuracyAuthorization } from '../../enums/AccuracyAuthorization';
26
+ export interface EventPayloads {
27
+ location: Location;
28
+ motionchange: MotionChangeEvent;
29
+ activitychange: MotionActivityEvent;
30
+ geofence: GeofenceEvent;
31
+ geofenceschange: GeofencesChangeEvent;
32
+ http: HttpEvent;
33
+ heartbeat: HeartbeatEvent;
34
+ providerchange: ProviderChangeEvent;
35
+ authorization: AuthorizationEvent;
36
+ connectivitychange: ConnectivityChangeEvent;
37
+ enabledchange: {
38
+ enabled: boolean;
39
+ };
40
+ powersavechange: {
41
+ isPowerSaveMode: boolean;
42
+ };
43
+ schedule: {
44
+ identifier?: string;
45
+ };
46
+ notification: {
47
+ action: string;
48
+ };
49
+ [event: string]: any;
50
+ }
51
+ export interface BackgroundGeolocationEvents {
52
+ onLocation(cb: (location: Location) => void, onError?: (err: LocationError) => void): Subscription;
53
+ onMotionChange(cb: (event: MotionChangeEvent) => void): Subscription;
54
+ onGeofence(cb: (event: GeofenceEvent) => void): Subscription;
55
+ onGeofencesChange(cb: (event: GeofencesChangeEvent) => void): Subscription;
56
+ onActivityChange(cb: (event: MotionActivityEvent) => void): Subscription;
57
+ onProviderChange(cb: (event: ProviderChangeEvent) => void): Subscription;
58
+ onHeartbeat(cb: (event: HeartbeatEvent) => void): Subscription;
59
+ onHttp(cb: (event: HttpEvent) => void): Subscription;
60
+ onSchedule(cb: (state: State) => void): Subscription;
61
+ onConnectivityChange(cb: (event: ConnectivityChangeEvent) => void): Subscription;
62
+ onPowerSaveChange(cb: (enabled: boolean) => void): Subscription;
63
+ onEnabledChange(cb: (enabled: boolean) => void): Subscription;
64
+ onNotificationAction(cb: (buttonId: string) => void): Subscription;
65
+ onAuthorization(cb: (event: AuthorizationEvent) => void): Subscription;
66
+ addListener(event: string, success: Function, failure?: Function): void;
67
+ removeListener(event: string, cb: Function): void;
68
+ removeListeners(): Promise<void>;
69
+ registerHeadlessTask(callback: (event: HeadlessEvent) => Promise<void>): void;
70
+ }
71
+ export interface BackgroundGeolocationAPI extends BackgroundGeolocationEvents {
72
+ readonly deviceSettings: DeviceSettings;
73
+ readonly logger: Logger;
74
+ ready(config: Config): Promise<State>;
75
+ reset(config: Config): Promise<State>;
76
+ start(): Promise<State>;
77
+ stop(): Promise<State>;
78
+ changePace(isMoving: boolean): Promise<State>;
79
+ startGeofences(): Promise<State>;
80
+ getState(): Promise<State>;
81
+ setConfig(config: Partial<Config>): Promise<State>;
82
+ getCurrentPosition(options?: CurrentPositionRequest): Promise<Location>;
83
+ watchPosition(cb: (location: Location) => void, options?: CurrentPositionRequest): Subscription;
84
+ stopWatchPosition?(sub?: Subscription): void;
85
+ resetOdometer(): Promise<number>;
86
+ setOdometer(value: number): Promise<number>;
87
+ getOdometer(): Promise<number>;
88
+ getProviderState(): Promise<ProviderChangeEvent>;
89
+ requestPermission(): Promise<AuthorizationStatus>;
90
+ requestTemporaryFullAccuracy(purposeKey: string): Promise<AccuracyAuthorization>;
91
+ addGeofence(geofence: Geofence): Promise<boolean>;
92
+ addGeofences(geofences: Geofence[]): Promise<boolean>;
93
+ removeGeofence(identifier: string): Promise<boolean>;
94
+ removeGeofences(identifiers?: string[]): Promise<boolean>;
95
+ getGeofences(): Promise<Geofence[]>;
96
+ getGeofence(identifier: string): Promise<Geofence>;
97
+ geofenceExists(identifier: string): Promise<boolean>;
98
+ startSchedule(): Promise<void>;
99
+ stopSchedule(): Promise<void>;
100
+ setLogLevel(level: LogLevel): Promise<void>;
101
+ setLogPersist(mode: PersistMode): Promise<void>;
102
+ getDeviceInfo(): Promise<DeviceInfo>;
103
+ getSensors(): Promise<Sensors>;
104
+ isPowerSaveMode(): Promise<boolean>;
105
+ destroyLocations(): Promise<void>;
106
+ destroyLocation(uuid: string): Promise<void>;
107
+ insertLocation(location: Location): Promise<Location>;
108
+ getLocations(): Promise<Array<Object>>;
109
+ getCount(): Promise<number>;
110
+ sync(): Promise<Array<Object>>;
111
+ startBackgroundTask(): Promise<number>;
112
+ stopBackgroundTask(taskId: number): Promise<void>;
113
+ finishHeadlessTask(taskId: string): Promise<number>;
114
+ }
161
115
  export interface BackgroundGeolocation extends BackgroundGeolocationAPI {
162
- /**
163
- * __LogLevel__
164
- * Controls verbosity of the SDK logger.
165
- * Used by LoggerConfig.logLevel.
166
- * Values range from silent (`Off`) to extremely verbose (`Verbose`).
167
- *
168
- * @example
169
- * ```ts
170
- * BackgroundGeolocation.ready({
171
- * logger: {
172
- * logLevel: BackgroundGeolocation.LogLevel.Verbose
173
- * }
174
- * });
175
- * ```
176
- * @readonly
177
- */
178
116
  LogLevel: typeof import('../../enums/LogLevel').LogLevel;
179
- /**
180
- * __DesiredAccuracy__
181
- * Controls the native location engine’s target accuracy.
182
- * Higher accuracy consumes more battery.
183
- * Used by GeoConfig.desiredAccuracy.
184
- *
185
- * @example
186
- * ```ts
187
- * BackgroundGeolocation.ready({
188
- * geolocation: {
189
- * desiredAccuracy: BackgroundGeolocation.DesiredAccuracy.High
190
- * }
191
- * });
192
- * ```
193
- * @readonly
194
- */
195
117
  DesiredAccuracy: typeof import('../../enums/DesiredAccuracy').DesiredAccuracy;
196
- /**
197
- * __PersistMode__
198
- * Controls which records the SDK persists to SQLite:
199
- * locations only, geofences only, both, or none.
200
- * Used by PersistenceConfig.persistMode.
201
- *
202
- * @example
203
- * ```ts
204
- * BackgroundGeolocation.ready({
205
- * persistence: {
206
- * persistMode: BackgroundGeolocation.PersistMode.All
207
- * }
208
- * });
209
- * ```
210
- * @readonly
211
- */
212
118
  PersistMode: typeof import('../../enums/PersistMode').PersistMode;
213
- /**
214
- * __AuthorizationStrategy__
215
- * Defines how the HTTP service performs authorization.
216
- * Includes basic, JWT, and custom strategies.
217
- * Used by AuthorizationConfig.strategy.
218
- *
219
- * @example
220
- * ```ts
221
- * BackgroundGeolocation.ready({
222
- * authorization: {
223
- * strategy: BackgroundGeolocation.AuthorizationStrategy.Jwt
224
- * }
225
- * });
226
- * ```
227
- * @readonly
228
- */
229
119
  AuthorizationStrategy: typeof import('../../enums/AuthorizationStrategy').AuthorizationStrategy;
230
- /**
231
- * __LocationFilterPolicy__
232
- * Selects the filtering engine policy for noise-reduction and smoothing.
233
- * Used by GeoConfig.locationFilter.
234
- *
235
- * @example
236
- * ```ts
237
- * BackgroundGeolocation.ready({
238
- * geolocation: {
239
- * filter: {
240
- * policy: BackgroundGeolocation.LocationFilterPolicy.Adjust
241
- * }
242
- * });
243
- * ```
244
- * @readonly
245
- */
246
120
  LocationFilterPolicy: typeof import('../../enums/LocationFilterPolicy').LocationFilterPolicy;
247
- /**
248
- * __KalmanProfile__
249
- * Selects a preset tuning profile for the Kalman filter used in the
250
- * filtering engine (aggressive, moderate, or relaxed smoothing).
251
- *
252
- * @example
253
- * ```ts
254
- * BackgroundGeolocation.ready({
255
- * geolocation: {
256
- * kalmanProfile: BackgroundGeolocation.KalmanProfile.Aggressive
257
- * }
258
- * });
259
- * ```
260
- * @readonly
261
- */
262
121
  KalmanProfile: typeof import('../../enums/KalmanProfile').KalmanProfile;
263
- /**
264
- * __HttpMethod__
265
- * Defines the HTTP method used for uploads (POST, PUT, etc).
266
- * Used by HttpConfig.method.
267
- *
268
- * @example
269
- * ```ts
270
- * BackgroundGeolocation.ready({
271
- * http: {
272
- * method: BackgroundGeolocation.HttpMethod.Post
273
- * }
274
- * });
275
- * ```
276
- * @readonly
277
- */
278
122
  HttpMethod: typeof import('../../enums/HttpMethod').HttpMethod;
279
- /**
280
- * __TriggerActivity__
281
- * Defines which physical motion activities can trigger motion-detection
282
- * transitions (still → moving).
283
- * Used by ActivityConfig.triggerActivities.
284
- *
285
- * @example
286
- * ```ts
287
- * BackgroundGeolocation.ready({
288
- * activity: {
289
- * triggerActivities: [
290
- * BackgroundGeolocation.TriggerActivity.InVehicle
291
- * ]
292
- * }
293
- * });
294
- * ```
295
- * @readonly
296
- */
297
123
  TriggerActivity: typeof import('../../enums/TriggerActivity').TriggerActivity;
298
- /**
299
- * __NotificationPriority__
300
- * Controls Android foreground-service notification priority and icon
301
- * placement (top, bottom, hidden).
302
- * Used by NotificationConfig.priority.
303
- *
304
- * @example
305
- * ```ts
306
- * BackgroundGeolocation.ready({
307
- * notification: {
308
- * priority: BackgroundGeolocation.NotificationPriority.High
309
- * }
310
- * });
311
- * ```
312
- * @readonly
313
- */
314
124
  NotificationPriority: typeof import('../../enums/NotificationPriority').NotificationPriority;
315
- /**
316
- * __Event__
317
- * Enumerates all event names emitted by the SDK (location, geofence,
318
- * motionchange, heartbeat, etc).
319
- *
320
- * @readonly
321
- */
322
125
  Event: typeof import('../../enums/Event').Event;
323
- /**
324
- * __LocationRequest__
325
- * Defines the type of permission request made to iOS (Always, WhenInUse,
326
- * or Any).
327
- * Used by GeoConfig.locationAuthorizationRequest.
328
- *
329
- * @example
330
- * ```ts
331
- * BackgroundGeolocation.ready({
332
- * geolocation: {
333
- * locationAuthorizationRequest: BackgroundGeolocation.LocationRequest.Always
334
- * }
335
- * });
336
- * ```
337
- * @readonly
338
- */
339
126
  LocationRequest: typeof import('../../enums/LocationRequest').LocationRequest;
340
- /**
341
- * __AccuracyAuthorization__
342
- * iOS 14+: Indicates whether the user granted full or reduced accuracy.
343
- * Used by ProviderChangeEvent.accuracyAuthorization and
344
- * requestTemporaryFullAccuracy.
345
- *
346
- * @example
347
- * ```ts
348
- * BackgroundGeolocation.onProviderChange((event) => {
349
- * if (event.accuracyAuthorization ===
350
- * BackgroundGeolocation.AccuracyAuthorization.Reduced) {
351
- * // Handle reduced-accuracy case
352
- * }
353
- * });
354
- * ```
355
- * @readonly
356
- */
357
127
  AccuracyAuthorization: typeof import('../../enums/AccuracyAuthorization').AccuracyAuthorization;
358
- /**
359
- * __AuthorizationStatus__
360
- * Represents OS-level authorization state for location-services
361
- * (Denied, Restricted, Always, WhenInUse).
362
- * Returned from requestPermission() and onProviderChange.
363
- *
364
- * @example
365
- * ```ts
366
- * const status = await BackgroundGeolocation.requestPermission();
367
- * if (status === BackgroundGeolocation.AuthorizationStatus.Always) {
368
- * // Good to start tracking
369
- * }
370
- * ```
371
- * @readonly
372
- */
373
128
  AuthorizationStatus: typeof import('../../enums/AuthorizationStatus').AuthorizationStatus;
129
+ ActivityType: typeof import('../../enums/ActivityType').ActivityType;
374
130
  }
@@ -1,44 +1,8 @@
1
- /**
2
- * Options provided to {@link BackgroundGeolocation.getCurrentPosition}.
3
- *
4
- * @example
5
- * ```typescript
6
- * let location = await BackgroundGeolocation.getCurrentPosition({
7
- * timeout: 30, // 30 second timeout to fetch location
8
- * persist: true, // Defaults to state.enabled
9
- * maximumAge: 5000, // Accept the last-known-location if not older than 5000 ms.
10
- * desiredAccuracy: 10, // Try to fetch a location with an accuracy of `10` meters.
11
- * samples: 3, // How many location samples to attempt.
12
- * extras: { // Custom meta-data.
13
- * "route_id": 123
14
- * }
15
- * });
16
- * ```
17
- * @category Primary API
18
- */
19
1
  export 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
2
  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
3
  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
4
  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
5
  persist?: boolean;
36
- /**
37
- * Accept the last-recorded-location if no older than supplied value in `milliseconds`. Default is `0`.
38
- */
39
6
  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
7
  extras?: Record<string, any>;
44
8
  }
@@ -1,77 +1,14 @@
1
- /**
2
- * An object for redirecting a User to an Android device's settings screen from a {@link DeviceSettings} request.
3
- *
4
- * Contains meta-data about the device (`manufacturer`, `model`, `version`) and whether you’ve already shown this screen.
5
- *
6
- * @category Device
7
- */
8
1
  export interface DeviceSettingsRequest {
9
- /** Device manufacturer (e.g., "Huawei", "Samsung"). */
10
2
  manufacturer: string;
11
- /** Device model (e.g., "P40", "SM-G991B"). */
12
3
  model: string;
13
- /** OS version string. */
14
4
  version: string;
15
- /** Whether this screen has previously been shown. */
16
5
  seen: boolean;
17
- /** Timestamp of when this screen was last shown. */
18
6
  lastSeenAt: Date;
19
- /**
20
- * The settings screen action to be shown.
21
- * ⚠️ Set automatically by the native layer.
22
- */
23
7
  action: string;
24
8
  }
25
- /**
26
- * Device Settings API (types-only).
27
- *
28
- * Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can
29
- * affect performance of the Background Geolocation SDK on various devices.
30
- *
31
- * See: https://dontkillmyapp.com/
32
- *
33
- * @example
34
- * ```ts
35
- * // Is Android device ignoring battery optimizations?
36
- * const isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
37
- * if (!isIgnoring) {
38
- * const req = await BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations();
39
- * if (!req.seen) {
40
- * const confirmed = await showMyConfirmDialog({ title: 'Settings request', text: 'Please disable battery optimizations' });
41
- * if (confirmed) {
42
- * await BackgroundGeolocation.deviceSettings.show(req);
43
- * }
44
- * }
45
- * }
46
- * ```
47
- * @category Device
48
- */
49
9
  export interface DeviceSettings {
50
- /**
51
- * Returns `true` if device is ignoring battery optimizations for your app.
52
- *
53
- * In most cases, the SDK performs normally with battery optimizations enabled.
54
- */
55
10
  isIgnoringBatteryOptimizations(): Promise<boolean>;
56
- /**
57
- * Prepare a request to show Android’s *Ignore Battery Optimizations* settings screen.
58
- *
59
- * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first so you can
60
- * decide whether to prompt the user (eg: avoid annoying them if `seen === true`).
61
- *
62
- * ⚠️ On some devices/OS versions, this screen may not exist; callers should `catch` errors.
63
- */
64
11
  showIgnoreBatteryOptimizations(): Promise<DeviceSettingsRequest>;
65
- /**
66
- * Prepare a request to show a vendor-specific “Power Manager” screen (Huawei, Xiaomi, Vivo, etc).
67
- *
68
- * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first.
69
- * Not all vendors/versions implement this screen; callers should `catch` errors.
70
- */
71
12
  showPowerManager(): Promise<DeviceSettingsRequest>;
72
- /**
73
- * Execute a previously prepared {@link DeviceSettingsRequest} to actually show the screen.
74
- * Resolves `true` if the redirect was attempted.
75
- */
76
13
  show(request: DeviceSettingsRequest): Promise<boolean>;
77
14
  }