expo-background-tracking 1.0.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/LICENSE +21 -0
- package/README.md +260 -0
- package/build/BackgroundGeolocation.d.ts +122 -0
- package/build/BackgroundGeolocation.js +901 -0
- package/build/Database.d.ts +30 -0
- package/build/Database.js +206 -0
- package/build/EventBus.d.ts +10 -0
- package/build/EventBus.js +37 -0
- package/build/GeofenceManager.d.ts +42 -0
- package/build/GeofenceManager.js +281 -0
- package/build/HttpService.d.ts +27 -0
- package/build/HttpService.js +265 -0
- package/build/Logger.d.ts +15 -0
- package/build/Logger.js +52 -0
- package/build/MotionDetector.d.ts +40 -0
- package/build/MotionDetector.js +141 -0
- package/build/Scheduler.d.ts +19 -0
- package/build/Scheduler.js +79 -0
- package/build/environment.d.ts +8 -0
- package/build/environment.js +26 -0
- package/build/geo.d.ts +10 -0
- package/build/geo.js +46 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +28 -0
- package/build/types.d.ts +275 -0
- package/build/types.js +56 -0
- package/package.json +351 -0
- package/src/BackgroundGeolocation.ts +1032 -0
- package/src/Database.ts +236 -0
- package/src/EventBus.ts +33 -0
- package/src/GeofenceManager.ts +269 -0
- package/src/HttpService.ts +232 -0
- package/src/Logger.ts +52 -0
- package/src/MotionDetector.ts +149 -0
- package/src/Scheduler.ts +90 -0
- package/src/environment.ts +22 -0
- package/src/geo.ts +57 -0
- package/src/index.ts +7 -0
- package/src/types.ts +410 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Farhati
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# expo-background-tracking
|
|
2
|
+
|
|
3
|
+
Tracking GPS & geofencing pour **Expo** (Android + iOS),100 % Expo, **sans Firebase**, sans code natif custom, **compatible Expo Go**.
|
|
4
|
+
|
|
5
|
+
Détection de mouvement économe en batterie (accéléromètre + vitesse GPS), persistance SQLite, synchronisation HTTP avec file offline, geofencing illimité (cercles + polygones), odomètre, planning hebdomadaire.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install expo-background-tracking
|
|
11
|
+
npx expo install expo-location expo-task-manager expo-sqlite expo-sensors expo-battery expo-network expo-device expo-constants
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Compatibilité Expo Go
|
|
15
|
+
|
|
16
|
+
| | Expo Go | Dev build / production |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| Tracking app ouverte (foreground) | ✅ | ✅ |
|
|
19
|
+
| Tracking app minimisée (background) | ❌* | ✅ |
|
|
20
|
+
| Geofencing | ✅ (logiciel, foreground) | ✅ (natif + logiciel) |
|
|
21
|
+
| SQLite, HTTP sync, odomètre, scheduler, motion-detection | ✅ | ✅ |
|
|
22
|
+
|
|
23
|
+
\* Limitation officielle d'Expo : le background location exige un development build ([docs Expo](https://docs.expo.dev/versions/latest/sdk/location/)). La lib détecte l'environnement automatiquement — **même code partout**, zéro crash dans Expo Go.
|
|
24
|
+
|
|
25
|
+
Pour le background complet (dev build), ajoutez dans `app.json` :
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"expo": {
|
|
30
|
+
"ios": { "infoPlist": { "UIBackgroundModes": ["location", "fetch"] } },
|
|
31
|
+
"android": { "permissions": ["ACCESS_BACKGROUND_LOCATION", "FOREGROUND_SERVICE", "FOREGROUND_SERVICE_LOCATION"] },
|
|
32
|
+
"plugins": [["expo-location", {
|
|
33
|
+
"isAndroidBackgroundLocationEnabled": true,
|
|
34
|
+
"isAndroidForegroundServiceEnabled": true
|
|
35
|
+
}]]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import BackgroundGeolocation from 'expo-background-tracking';
|
|
44
|
+
|
|
45
|
+
// 1. Écouter les événements
|
|
46
|
+
const sub = BackgroundGeolocation.onLocation((location) => {
|
|
47
|
+
console.log('[location]', location.coords);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
BackgroundGeolocation.onMotionChange(({ isMoving, location }) => {
|
|
51
|
+
console.log('[motionchange]', isMoving);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
BackgroundGeolocation.onGeofence(({ identifier, action }) => {
|
|
55
|
+
console.log('[geofence]', identifier, action);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 2. Configurer (ready, une seule fois)
|
|
59
|
+
const state = await BackgroundGeolocation.ready({
|
|
60
|
+
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
|
|
61
|
+
distanceFilter: 10,
|
|
62
|
+
stopTimeout: 5,
|
|
63
|
+
url: 'https://your-server.com/locations', // HTTP sync — fetch natif, pas de Firebase
|
|
64
|
+
autoSync: true,
|
|
65
|
+
batchSync: false,
|
|
66
|
+
headers: { 'X-API-KEY': 'xyz' },
|
|
67
|
+
debug: true,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// 3. Démarrer
|
|
71
|
+
if (!state.enabled) {
|
|
72
|
+
await BackgroundGeolocation.start();
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Geofencing (illimité, cercles + polygones)
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
await BackgroundGeolocation.addGeofence({
|
|
80
|
+
identifier: 'HOME',
|
|
81
|
+
latitude: 48.8566,
|
|
82
|
+
longitude: 2.3522,
|
|
83
|
+
radius: 200,
|
|
84
|
+
notifyOnEntry: true,
|
|
85
|
+
notifyOnExit: true,
|
|
86
|
+
notifyOnDwell: true,
|
|
87
|
+
loiteringDelay: 60000,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Polygone (évalué en logiciel)
|
|
91
|
+
await BackgroundGeolocation.addGeofence({
|
|
92
|
+
identifier: 'ZONE',
|
|
93
|
+
vertices: [[48.85, 2.34], [48.86, 2.34], [48.86, 2.36], [48.85, 2.36]],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await BackgroundGeolocation.startGeofences(); // mode geofences-only
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Envoi HTTP des positions vers votre serveur
|
|
100
|
+
|
|
101
|
+
La lib embarque un service HTTP complet (basé sur `fetch`, **sans Firebase**) : chaque position est persistée en SQLite puis envoyée à votre `url`. En cas d'échec (hors-ligne, erreur serveur), les positions restent en file et repartent automatiquement à la reconnexion.
|
|
102
|
+
|
|
103
|
+
### Configuration de base
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
await BackgroundGeolocation.ready({
|
|
107
|
+
url: 'https://votre-serveur.com/locations', // destination des positions
|
|
108
|
+
method: 'POST', // 'POST' (défaut) | 'PUT' | 'OPTIONS'
|
|
109
|
+
headers: { // headers HTTP personnalisés
|
|
110
|
+
'X-API-KEY': 'abc123',
|
|
111
|
+
'Authorization': 'Bearer ...',
|
|
112
|
+
},
|
|
113
|
+
params: { // champs ajoutés à la racine du corps JSON
|
|
114
|
+
device_id: 'phone-01',
|
|
115
|
+
company_id: 7,
|
|
116
|
+
},
|
|
117
|
+
extras: { // attachés à CHAQUE position envoyée
|
|
118
|
+
user_id: 42,
|
|
119
|
+
mission: 'livraison',
|
|
120
|
+
},
|
|
121
|
+
autoSync: true, // envoi automatique à chaque position
|
|
122
|
+
httpTimeout: 60000, // timeout requête en ms
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Contrôler le nombre et la fréquence des envois
|
|
127
|
+
|
|
128
|
+
| Option | Effet |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `autoSync: true` | Envoie automatiquement chaque nouvelle position |
|
|
131
|
+
| `autoSyncThreshold: 10` | N'envoie qu'à partir de **10 positions** accumulées en file |
|
|
132
|
+
| `batchSync: true` | Envoie les positions **en lot** (1 requête HTTP = N positions) |
|
|
133
|
+
| `maxBatchSize: 50` | Maximum **50 positions par requête** (les lots s'enchaînent) |
|
|
134
|
+
| `autoSync: false` + `sync()` | Envoi **100 % manuel**, quand vous le décidez |
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// Exemple : économiser la batterie/réseau — 1 requête tous les 25 points, par lots
|
|
138
|
+
await BackgroundGeolocation.ready({
|
|
139
|
+
url: 'https://votre-serveur.com/locations',
|
|
140
|
+
autoSync: true,
|
|
141
|
+
autoSyncThreshold: 25,
|
|
142
|
+
batchSync: true,
|
|
143
|
+
maxBatchSize: 100,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Envoi manuel (par ex. sur bouton ou à la fin d'une mission)
|
|
147
|
+
const uploaded = await BackgroundGeolocation.sync();
|
|
148
|
+
console.log(`${uploaded.length} positions envoyées`);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Format du payload reçu par votre serveur
|
|
152
|
+
|
|
153
|
+
Par défaut (`httpRootProperty: 'location'`) :
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"location": {
|
|
158
|
+
"uuid": "f3f57a91-…",
|
|
159
|
+
"timestamp": "2026-06-12T14:32:11.000Z",
|
|
160
|
+
"odometer": 1842.5,
|
|
161
|
+
"is_moving": true,
|
|
162
|
+
"coords": {
|
|
163
|
+
"latitude": 48.856614, "longitude": 2.352222,
|
|
164
|
+
"accuracy": 5, "speed": 1.4, "heading": 270, "altitude": 35
|
|
165
|
+
},
|
|
166
|
+
"activity": { "activity": "walking", "confidence": 75 },
|
|
167
|
+
"battery": { "level": 0.82, "is_charging": false },
|
|
168
|
+
"extras": { "user_id": 42, "mission": "livraison" }
|
|
169
|
+
},
|
|
170
|
+
"device_id": "phone-01",
|
|
171
|
+
"company_id": 7
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Avec `batchSync: true`, `"location"` devient un **tableau** de positions.
|
|
176
|
+
|
|
177
|
+
### Personnaliser le format
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
await BackgroundGeolocation.ready({
|
|
181
|
+
url: '…',
|
|
182
|
+
httpRootProperty: 'data', // { "data": {...} } — ou '.' pour aucun wrapper
|
|
183
|
+
locationTemplate: '{"lat":<%= latitude %>,"lng":<%= longitude %>,"ts":<%= timestamp %>,"batt":<%= battery.level %>}',
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Variables de template : `latitude`, `longitude`, `accuracy`, `speed`, `heading`, `altitude`, `timestamp`, `uuid`, `odometer`, `is_moving`, `activity.type`, `activity.confidence`, `battery.level`, `battery.is_charging`.
|
|
188
|
+
|
|
189
|
+
### Suivre les envois
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
BackgroundGeolocation.onHttp((response) => {
|
|
193
|
+
console.log('[http]', response.status, response.success, response.responseText);
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Persistance & sync manuel
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
const count = await BackgroundGeolocation.getCount(); // positions en file
|
|
201
|
+
const locations = await BackgroundGeolocation.getLocations(); // lire la file
|
|
202
|
+
const uploaded = await BackgroundGeolocation.sync(); // envoyer maintenant
|
|
203
|
+
await BackgroundGeolocation.destroyLocations(); // vider la file
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Options de rétention : `maxDaysToPersist` (défaut 1 jour), `maxRecordsToPersist`, `persistMode` (`ALL` | `LOCATION` | `GEOFENCE` | `NONE`).
|
|
207
|
+
|
|
208
|
+
### Planning
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
await BackgroundGeolocation.ready({
|
|
212
|
+
schedule: ['1-5 09:00-17:00', '6 10:00-14:00'], // lun-ven 9h-17h, sam 10h-14h
|
|
213
|
+
});
|
|
214
|
+
await BackgroundGeolocation.startSchedule();
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Odomètre, capteurs, état
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
const km = (await BackgroundGeolocation.getOdometer()) / 1000;
|
|
221
|
+
await BackgroundGeolocation.resetOdometer();
|
|
222
|
+
const sensors = await BackgroundGeolocation.getSensors();
|
|
223
|
+
const providerState = await BackgroundGeolocation.getProviderState();
|
|
224
|
+
const powerSave = await BackgroundGeolocation.isPowerSaveMode();
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Auth JWT avec refresh automatique (sur 401)
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
await BackgroundGeolocation.ready({
|
|
231
|
+
url: 'https://api.example.com/locations',
|
|
232
|
+
authorization: {
|
|
233
|
+
strategy: 'JWT',
|
|
234
|
+
accessToken: 'eyJ...',
|
|
235
|
+
refreshToken: 'def...',
|
|
236
|
+
refreshUrl: 'https://api.example.com/auth/refresh',
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
BackgroundGeolocation.onAuthorization((event) => console.log(event));
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## API complète
|
|
243
|
+
|
|
244
|
+
Événements : `onLocation`, `onMotionChange`, `onActivityChange`, `onGeofence`, `onGeofencesChange`, `onHeartbeat`, `onHttp`, `onProviderChange`, `onConnectivityChange`, `onPowerSaveChange`, `onEnabledChange`, `onSchedule`, `onAuthorization`.
|
|
245
|
+
|
|
246
|
+
Méthodes : `ready`, `start`, `stop`, `startGeofences`, `startSchedule`, `stopSchedule`, `changePace`, `getCurrentPosition`, `watchPosition`, `stopWatchPosition`, `getState`, `setConfig`, `reset`, `getLocations`, `getCount`, `insertLocation`, `destroyLocations`, `destroyLocation`, `sync`, `getOdometer`, `setOdometer`, `resetOdometer`, `addGeofence`, `addGeofences`, `removeGeofence`, `removeGeofences`, `getGeofences`, `getGeofence`, `geofenceExists`, `getSensors`, `getDeviceInfo`, `isPowerSaveMode`, `getProviderState`, `requestPermission`, `requestTemporaryFullAccuracy`, `registerHeadlessTask`, `startBackgroundTask`, `stopBackgroundTask`, `getLog`, `destroyLog`, `emailLog`, `removeListeners`.
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## App de test
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
cd testapp
|
|
254
|
+
npm install
|
|
255
|
+
npx expo start --clear
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Licence
|
|
259
|
+
|
|
260
|
+
MIT
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { AccuracyAuthorization, AuthorizationStatus, DesiredAccuracy, LogLevel, PersistMode, type ActivityChangeEvent, type Config, type ConnectivityChangeEvent, type CurrentPositionRequest, type DeviceInfo, type GeofencesChangeEvent, type Geofence, type GeofenceEvent, type HeadlessTask, type HeartbeatEvent, type HttpEvent, type Location, type MotionChangeEvent, type ProviderChangeEvent, type ScheduleEvent, type Sensors, type SQLQuery, type State, type Subscription, type WatchPositionRequest, type AuthorizationEvent } from './types';
|
|
2
|
+
export declare const LOCATION_TASK = "expo-background-tracking.location";
|
|
3
|
+
declare class BackgroundGeolocationImpl {
|
|
4
|
+
readonly DESIRED_ACCURACY_NAVIGATION = DesiredAccuracy.NAVIGATION;
|
|
5
|
+
readonly DESIRED_ACCURACY_HIGH = DesiredAccuracy.HIGH;
|
|
6
|
+
readonly DESIRED_ACCURACY_MEDIUM = DesiredAccuracy.MEDIUM;
|
|
7
|
+
readonly DESIRED_ACCURACY_LOW = DesiredAccuracy.LOW;
|
|
8
|
+
readonly DESIRED_ACCURACY_VERY_LOW = DesiredAccuracy.VERY_LOW;
|
|
9
|
+
readonly LOG_LEVEL_OFF = LogLevel.OFF;
|
|
10
|
+
readonly LOG_LEVEL_ERROR = LogLevel.ERROR;
|
|
11
|
+
readonly LOG_LEVEL_WARNING = LogLevel.WARNING;
|
|
12
|
+
readonly LOG_LEVEL_INFO = LogLevel.INFO;
|
|
13
|
+
readonly LOG_LEVEL_DEBUG = LogLevel.DEBUG;
|
|
14
|
+
readonly LOG_LEVEL_VERBOSE = LogLevel.VERBOSE;
|
|
15
|
+
readonly PERSIST_MODE_ALL = PersistMode.ALL;
|
|
16
|
+
readonly PERSIST_MODE_LOCATION = PersistMode.LOCATION;
|
|
17
|
+
readonly PERSIST_MODE_GEOFENCE = PersistMode.GEOFENCE;
|
|
18
|
+
readonly PERSIST_MODE_NONE = PersistMode.NONE;
|
|
19
|
+
readonly AUTHORIZATION_STATUS_ALWAYS = AuthorizationStatus.ALWAYS;
|
|
20
|
+
readonly AUTHORIZATION_STATUS_WHEN_IN_USE = AuthorizationStatus.WHEN_IN_USE;
|
|
21
|
+
readonly AUTHORIZATION_STATUS_DENIED = AuthorizationStatus.DENIED;
|
|
22
|
+
readonly logger: import("./Logger").Logger;
|
|
23
|
+
private bus;
|
|
24
|
+
private http;
|
|
25
|
+
private geofenceManager;
|
|
26
|
+
private motion;
|
|
27
|
+
private scheduler;
|
|
28
|
+
private config;
|
|
29
|
+
private enabled;
|
|
30
|
+
private trackingMode;
|
|
31
|
+
private odometer;
|
|
32
|
+
private lastLocation;
|
|
33
|
+
private lastPersistedCoords;
|
|
34
|
+
private isReady;
|
|
35
|
+
private foregroundSub;
|
|
36
|
+
private watchSub;
|
|
37
|
+
private heartbeatTimer;
|
|
38
|
+
private providerTimer;
|
|
39
|
+
private powerSaveSub;
|
|
40
|
+
private lastProviderState;
|
|
41
|
+
private headlessTask;
|
|
42
|
+
private bgTaskCounter;
|
|
43
|
+
constructor();
|
|
44
|
+
private defineTasks;
|
|
45
|
+
private dispatchHeadless;
|
|
46
|
+
ready(config?: Config): Promise<State>;
|
|
47
|
+
start(): Promise<State>;
|
|
48
|
+
stop(): Promise<State>;
|
|
49
|
+
/** Geofences-only mode: no continuous location tracking. */
|
|
50
|
+
startGeofences(): Promise<State>;
|
|
51
|
+
startSchedule(): Promise<State>;
|
|
52
|
+
stopSchedule(): Promise<State>;
|
|
53
|
+
changePace(isMoving: boolean): Promise<void>;
|
|
54
|
+
private setEnabled;
|
|
55
|
+
private assertReady;
|
|
56
|
+
private mapAccuracy;
|
|
57
|
+
private startForegroundWatch;
|
|
58
|
+
private startBackgroundUpdates;
|
|
59
|
+
private effectiveDistanceFilter;
|
|
60
|
+
private buildLocation;
|
|
61
|
+
private shouldPersist;
|
|
62
|
+
private processLocation;
|
|
63
|
+
private handleMotionChange;
|
|
64
|
+
private fetchCurrentLocation;
|
|
65
|
+
getCurrentPosition(options?: CurrentPositionRequest): Promise<Location>;
|
|
66
|
+
watchPosition(success: (location: Location) => void, failure?: (error: unknown) => void, options?: WatchPositionRequest): Promise<void>;
|
|
67
|
+
stopWatchPosition(): Promise<void>;
|
|
68
|
+
getState(): Promise<State>;
|
|
69
|
+
setConfig(config: Config): Promise<State>;
|
|
70
|
+
reset(config?: Config): Promise<State>;
|
|
71
|
+
getLocations(query?: SQLQuery): Promise<Location[]>;
|
|
72
|
+
getCount(): Promise<number>;
|
|
73
|
+
insertLocation(location: Partial<Location>): Promise<string>;
|
|
74
|
+
destroyLocations(): Promise<void>;
|
|
75
|
+
destroyLocation(uuid: string): Promise<void>;
|
|
76
|
+
sync(): Promise<Location[]>;
|
|
77
|
+
getOdometer(): Promise<number>;
|
|
78
|
+
setOdometer(value: number): Promise<Location>;
|
|
79
|
+
resetOdometer(): Promise<Location>;
|
|
80
|
+
addGeofence(geofence: Geofence): Promise<boolean>;
|
|
81
|
+
addGeofences(geofences: Geofence[]): Promise<boolean>;
|
|
82
|
+
removeGeofence(identifier: string): Promise<boolean>;
|
|
83
|
+
removeGeofences(identifiers?: string[]): Promise<boolean>;
|
|
84
|
+
getGeofences(): Promise<Geofence[]>;
|
|
85
|
+
getGeofence(identifier: string): Promise<Geofence | null>;
|
|
86
|
+
geofenceExists(identifier: string): Promise<boolean>;
|
|
87
|
+
getSensors(): Promise<Sensors>;
|
|
88
|
+
getDeviceInfo(): Promise<DeviceInfo>;
|
|
89
|
+
isPowerSaveMode(): Promise<boolean>;
|
|
90
|
+
private startPowerSaveMonitoring;
|
|
91
|
+
requestPermission(): Promise<AuthorizationStatus>;
|
|
92
|
+
requestTemporaryFullAccuracy(_purpose: string): Promise<AccuracyAuthorization>;
|
|
93
|
+
getProviderState(): Promise<ProviderChangeEvent>;
|
|
94
|
+
private startProviderMonitoring;
|
|
95
|
+
private startHeartbeat;
|
|
96
|
+
private stopHeartbeat;
|
|
97
|
+
startBackgroundTask(): Promise<number>;
|
|
98
|
+
stopBackgroundTask(_taskId: number): Promise<void>;
|
|
99
|
+
registerHeadlessTask(task: HeadlessTask): void;
|
|
100
|
+
getLog(): Promise<string>;
|
|
101
|
+
destroyLog(): Promise<void>;
|
|
102
|
+
emailLog(_email: string): Promise<string>;
|
|
103
|
+
playSound(_soundId: number | string): Promise<void>;
|
|
104
|
+
onLocation(success: (location: Location) => void, failure?: (error: unknown) => void): Subscription;
|
|
105
|
+
onMotionChange(fn: (event: MotionChangeEvent) => void): Subscription;
|
|
106
|
+
onActivityChange(fn: (event: ActivityChangeEvent) => void): Subscription;
|
|
107
|
+
onGeofence(fn: (event: GeofenceEvent) => void): Subscription;
|
|
108
|
+
onGeofencesChange(fn: (event: GeofencesChangeEvent) => void): Subscription;
|
|
109
|
+
onHeartbeat(fn: (event: HeartbeatEvent) => void): Subscription;
|
|
110
|
+
onHttp(fn: (event: HttpEvent) => void): Subscription;
|
|
111
|
+
onProviderChange(fn: (event: ProviderChangeEvent) => void): Subscription;
|
|
112
|
+
onConnectivityChange(fn: (event: ConnectivityChangeEvent) => void): Subscription;
|
|
113
|
+
onPowerSaveChange(fn: (isPowerSaveMode: boolean) => void): Subscription;
|
|
114
|
+
onEnabledChange(fn: (enabled: boolean) => void): Subscription;
|
|
115
|
+
onSchedule(fn: (event: ScheduleEvent) => void): Subscription;
|
|
116
|
+
onAuthorization(fn: (event: AuthorizationEvent) => void): Subscription;
|
|
117
|
+
onNotificationAction(fn: (buttonId: string) => void): Subscription;
|
|
118
|
+
removeListeners(): void;
|
|
119
|
+
removeAllListeners(): void;
|
|
120
|
+
}
|
|
121
|
+
export declare const BackgroundGeolocation: BackgroundGeolocationImpl;
|
|
122
|
+
export {};
|