@josuelmm/cordova-background-geolocation 3.1.0 → 3.2.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/CHANGELOG.md +55 -0
- package/HISTORY.md +6 -0
- package/README.md +62 -9
- package/RELEASE.MD +15 -4
- package/android/CDVBackgroundGeolocation/src/main/java/com/marianhello/bgloc/cordova/ConfigMapper.java +8 -0
- package/android/CDVBackgroundGeolocation/src/main/java/com/tenforwardconsulting/bgloc/cordova/BackgroundGeolocationPlugin.java +57 -1
- package/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java +26 -0
- package/android/common/src/main/java/com/marianhello/bgloc/Config.java +44 -0
- package/android/common/src/main/java/com/marianhello/bgloc/PostLocationTask.java +13 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/SessionLocationDAO.java +18 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationContract.java +5 -1
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationDAO.java +13 -1
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java +13 -1
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionContract.java +74 -0
- package/android/common/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionLocationDAO.java +169 -0
- package/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +132 -4
- package/angular/background-geolocation.service.ts +28 -0
- package/angular/dist/background-geolocation.service.d.ts +4 -0
- package/angular/dist/esm2022/background-geolocation.service.mjs +13 -1
- package/angular/dist/fesm2022/josuelmm-cordova-background-geolocation.mjs +12 -0
- package/angular/dist/fesm2022/josuelmm-cordova-background-geolocation.mjs.map +1 -1
- package/angular/dist/public-api.d.ts +1 -1
- package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.h +4 -0
- package/ios/CDVBackgroundGeolocation/CDVBackgroundGeolocation.m +41 -1
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.h +4 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +21 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.m +12 -3
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +5 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.h +29 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.m +31 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.m +153 -0
- package/package.json +7 -3
- package/plugin.xml +8 -1
- package/www/BackgroundGeolocation.d.ts +60 -0
- package/www/BackgroundGeolocation.js +24 -0
- package/www/cordova-channel-stub.js +27 -0
- package/www/cordova-exec-stub.js +15 -0
|
@@ -214,6 +214,24 @@ export interface ConfigureOptions {
|
|
|
214
214
|
*/
|
|
215
215
|
notificationText?: string;
|
|
216
216
|
|
|
217
|
+
/**
|
|
218
|
+
* When true, the foreground notification shows a live elapsed time (HH:mm:ss) since the session started.
|
|
219
|
+
* Requires startForeground. Updates every second.
|
|
220
|
+
*
|
|
221
|
+
* Platform: Android
|
|
222
|
+
* @default false
|
|
223
|
+
*/
|
|
224
|
+
showTime?: boolean;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* When true, the foreground notification shows accumulated distance (km) since the session started.
|
|
228
|
+
* Requires startForeground. Updates when each new location is received.
|
|
229
|
+
*
|
|
230
|
+
* Platform: Android
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
showDistance?: boolean;
|
|
234
|
+
|
|
217
235
|
/**
|
|
218
236
|
* Title shown in the notification while locations are syncing to the server.
|
|
219
237
|
* Use this (and notificationSyncText, etc.) to localize sync notifications.
|
|
@@ -786,6 +804,48 @@ export interface BackgroundGeolocationPlugin {
|
|
|
786
804
|
fail?: (error: BackgroundGeolocationError) => void
|
|
787
805
|
): Promise<number>;
|
|
788
806
|
|
|
807
|
+
/**
|
|
808
|
+
* Start recording session: clear session table and store all new locations in it.
|
|
809
|
+
* Call when user starts a route. Session locations are independent of sync (not cleared when sync succeeds).
|
|
810
|
+
*
|
|
811
|
+
* Platform: Android, iOS
|
|
812
|
+
*/
|
|
813
|
+
startSession(
|
|
814
|
+
success?: () => void,
|
|
815
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
816
|
+
): Promise<void>;
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Return all locations stored in the current session (ordered by time).
|
|
820
|
+
* Same format as Location (latitude, longitude, time, speed, altitude, bearing, accuracy).
|
|
821
|
+
*
|
|
822
|
+
* Platform: Android, iOS
|
|
823
|
+
*/
|
|
824
|
+
getSessionLocations(
|
|
825
|
+
success?: (locations: Location[]) => void,
|
|
826
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
827
|
+
): Promise<Location[]>;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Clear the session table and stop storing. Call when route is finished and sync OK.
|
|
831
|
+
*
|
|
832
|
+
* Platform: Android, iOS
|
|
833
|
+
*/
|
|
834
|
+
clearSession(
|
|
835
|
+
success?: () => void,
|
|
836
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
837
|
+
): Promise<void>;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Get the number of locations in the current session.
|
|
841
|
+
*
|
|
842
|
+
* Platform: Android, iOS
|
|
843
|
+
*/
|
|
844
|
+
getSessionLocationsCount(
|
|
845
|
+
success?: (count: number) => void,
|
|
846
|
+
fail?: (error: BackgroundGeolocationError) => void
|
|
847
|
+
): Promise<number>;
|
|
848
|
+
|
|
789
849
|
/**
|
|
790
850
|
* Get stored configuration options.
|
|
791
851
|
*
|
|
@@ -233,6 +233,30 @@ var BackgroundGeolocation = {
|
|
|
233
233
|
'getPendingSyncCount');
|
|
234
234
|
},
|
|
235
235
|
|
|
236
|
+
startSession: function (success, failure) {
|
|
237
|
+
return execWithPromise(success,
|
|
238
|
+
failure,
|
|
239
|
+
'startSession');
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
getSessionLocations: function (success, failure) {
|
|
243
|
+
return execWithPromise(success,
|
|
244
|
+
failure,
|
|
245
|
+
'getSessionLocations');
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
clearSession: function (success, failure) {
|
|
249
|
+
return execWithPromise(success,
|
|
250
|
+
failure,
|
|
251
|
+
'clearSession');
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
getSessionLocationsCount: function (success, failure) {
|
|
255
|
+
return execWithPromise(success,
|
|
256
|
+
failure,
|
|
257
|
+
'getSessionLocationsCount');
|
|
258
|
+
},
|
|
259
|
+
|
|
236
260
|
on: function (event, callbackFn) {
|
|
237
261
|
assert(this.events.indexOf(event) > -1, [TAG, '#on unknown event "' + event + '"']);
|
|
238
262
|
if (!callbackFn) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub for cordova/channel so the plugin can be bundled by webpack (ng serve / browser).
|
|
3
|
+
* When running inside Cordova (native), uses the real cordova channel.
|
|
4
|
+
* When running in browser, provides deviceready.subscribe() that runs the callback on load.
|
|
5
|
+
*/
|
|
6
|
+
function getChannel() {
|
|
7
|
+
if (typeof window !== 'undefined' && window.cordova && typeof window.cordova.require === 'function') {
|
|
8
|
+
try {
|
|
9
|
+
return window.cordova.require('cordova/channel');
|
|
10
|
+
} catch (e) {}
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
deviceready: {
|
|
14
|
+
subscribe: function (cb) {
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
if (document.readyState === 'complete') {
|
|
17
|
+
setTimeout(cb, 0);
|
|
18
|
+
} else {
|
|
19
|
+
window.addEventListener('load', cb);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = getChannel();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub for cordova/exec so the plugin can be bundled by webpack (ng serve / browser).
|
|
3
|
+
* When running inside Cordova (native), delegates to the real cordova.exec.
|
|
4
|
+
* When running in browser, calls the failure callback so the app does not break.
|
|
5
|
+
*/
|
|
6
|
+
function exec(success, fail, service, method, args) {
|
|
7
|
+
if (typeof window !== 'undefined' && window.cordova && typeof window.cordova.exec === 'function') {
|
|
8
|
+
return window.cordova.exec(success, fail, service, method, args || []);
|
|
9
|
+
}
|
|
10
|
+
if (typeof fail === 'function') {
|
|
11
|
+
fail({ message: 'Cordova is not available. Run on a device or emulator.' });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = exec;
|