@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/CapgoBackgroundGeolocation.podspec +13 -0
- package/LICENSE +18 -0
- package/README.md +221 -0
- package/android/build.gradle +62 -0
- package/android/src/main/AndroidManifest.xml +21 -0
- package/android/src/main/java/com/capgo/capacitor_background_geolocation/BackgroundGeolocation.java +364 -0
- package/android/src/main/java/com/capgo/capacitor_background_geolocation/BackgroundGeolocationService.java +177 -0
- package/dist/docs.json +421 -0
- package/dist/esm/definitions.d.ts +229 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +11 -0
- package/dist/esm/web.js +58 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +72 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +75 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Plugin.h +10 -0
- package/ios/Plugin/Plugin.m +8 -0
- package/ios/Plugin/Plugin.swift +230 -0
- package/package.json +87 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
import type { BackgroundGeolocationPlugin, WatcherOptions, Location, CallbackError } from "./definitions";
|
|
3
|
+
export declare class BackgroundGeolocationWeb extends WebPlugin implements BackgroundGeolocationPlugin {
|
|
4
|
+
private watchers;
|
|
5
|
+
private watcherCounter;
|
|
6
|
+
addWatcher(options: WatcherOptions, callback: (position?: Location, error?: CallbackError) => void): Promise<string>;
|
|
7
|
+
removeWatcher(options: {
|
|
8
|
+
id: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
openSettings(): Promise<void>;
|
|
11
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
export class BackgroundGeolocationWeb extends WebPlugin {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.watchers = new Map();
|
|
6
|
+
this.watcherCounter = 0;
|
|
7
|
+
}
|
|
8
|
+
async addWatcher(options, callback) {
|
|
9
|
+
const watcherId = `watcher_${++this.watcherCounter}`;
|
|
10
|
+
if (!navigator.geolocation) {
|
|
11
|
+
callback(undefined, {
|
|
12
|
+
name: "GeolocationError",
|
|
13
|
+
message: "Geolocation is not supported by this browser",
|
|
14
|
+
code: "NOT_SUPPORTED",
|
|
15
|
+
});
|
|
16
|
+
return watcherId;
|
|
17
|
+
}
|
|
18
|
+
const watchId = navigator.geolocation.watchPosition((position) => {
|
|
19
|
+
const location = {
|
|
20
|
+
latitude: position.coords.latitude,
|
|
21
|
+
longitude: position.coords.longitude,
|
|
22
|
+
accuracy: position.coords.accuracy,
|
|
23
|
+
altitude: position.coords.altitude,
|
|
24
|
+
altitudeAccuracy: position.coords.altitudeAccuracy,
|
|
25
|
+
simulated: false,
|
|
26
|
+
bearing: position.coords.heading,
|
|
27
|
+
speed: position.coords.speed,
|
|
28
|
+
time: position.timestamp,
|
|
29
|
+
};
|
|
30
|
+
callback(location);
|
|
31
|
+
}, (error) => {
|
|
32
|
+
const callbackError = {
|
|
33
|
+
name: "GeolocationError",
|
|
34
|
+
message: error.message,
|
|
35
|
+
code: error.code.toString(),
|
|
36
|
+
};
|
|
37
|
+
callback(undefined, callbackError);
|
|
38
|
+
}, {
|
|
39
|
+
enableHighAccuracy: true,
|
|
40
|
+
timeout: 10000,
|
|
41
|
+
maximumAge: options.stale ? 300000 : 0,
|
|
42
|
+
});
|
|
43
|
+
this.watchers.set(watcherId, { watchId, callback });
|
|
44
|
+
return watcherId;
|
|
45
|
+
}
|
|
46
|
+
async removeWatcher(options) {
|
|
47
|
+
const watcher = this.watchers.get(options.id);
|
|
48
|
+
if (watcher) {
|
|
49
|
+
navigator.geolocation.clearWatch(watcher.watchId);
|
|
50
|
+
this.watchers.delete(options.id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async openSettings() {
|
|
54
|
+
console.log("openSettings: Web implementation cannot open native settings");
|
|
55
|
+
window.alert("Please enable location permissions in your browser settings");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,wBACX,SAAQ,SAAS;IADnB;;QAIU,aAAQ,GAAG,IAAI,GAAG,EAMvB,CAAC;QACI,mBAAc,GAAG,CAAC,CAAC;IA+D7B,CAAC;IA7DC,KAAK,CAAC,UAAU,CACd,OAAuB,EACvB,QAA8D;QAE9D,MAAM,SAAS,GAAG,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QAErD,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,QAAQ,CAAC,SAAS,EAAE;gBAClB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,8CAA8C;gBACvD,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,aAAa,CACjD,CAAC,QAAQ,EAAE,EAAE;YACX,MAAM,QAAQ,GAAa;gBACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;gBAClC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;gBACpC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;gBAClC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;gBAClC,gBAAgB,EAAE,QAAQ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CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n BackgroundGeolocationPlugin,\n WatcherOptions,\n Location,\n CallbackError,\n} from \"./definitions\";\n\nexport class BackgroundGeolocationWeb\n extends WebPlugin\n implements BackgroundGeolocationPlugin\n{\n private watchers = new Map<\n string,\n {\n watchId: number;\n callback: (position?: Location, error?: CallbackError) => void;\n }\n >();\n private watcherCounter = 0;\n\n async addWatcher(\n options: WatcherOptions,\n callback: (position?: Location, error?: CallbackError) => void,\n ): Promise<string> {\n const watcherId = `watcher_${++this.watcherCounter}`;\n\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n\n const watchId = navigator.geolocation.watchPosition(\n (position) => {\n const location: Location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n },\n (error) => {\n const callbackError: CallbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n },\n {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n },\n );\n\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n\n async removeWatcher(options: { id: string }): Promise<void> {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n\n async openSettings(): Promise<void> {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const BackgroundGeolocation = core.registerPlugin("BackgroundGeolocation", {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BackgroundGeolocationWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class BackgroundGeolocationWeb extends core.WebPlugin {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.watchers = new Map();
|
|
13
|
+
this.watcherCounter = 0;
|
|
14
|
+
}
|
|
15
|
+
async addWatcher(options, callback) {
|
|
16
|
+
const watcherId = `watcher_${++this.watcherCounter}`;
|
|
17
|
+
if (!navigator.geolocation) {
|
|
18
|
+
callback(undefined, {
|
|
19
|
+
name: "GeolocationError",
|
|
20
|
+
message: "Geolocation is not supported by this browser",
|
|
21
|
+
code: "NOT_SUPPORTED",
|
|
22
|
+
});
|
|
23
|
+
return watcherId;
|
|
24
|
+
}
|
|
25
|
+
const watchId = navigator.geolocation.watchPosition((position) => {
|
|
26
|
+
const location = {
|
|
27
|
+
latitude: position.coords.latitude,
|
|
28
|
+
longitude: position.coords.longitude,
|
|
29
|
+
accuracy: position.coords.accuracy,
|
|
30
|
+
altitude: position.coords.altitude,
|
|
31
|
+
altitudeAccuracy: position.coords.altitudeAccuracy,
|
|
32
|
+
simulated: false,
|
|
33
|
+
bearing: position.coords.heading,
|
|
34
|
+
speed: position.coords.speed,
|
|
35
|
+
time: position.timestamp,
|
|
36
|
+
};
|
|
37
|
+
callback(location);
|
|
38
|
+
}, (error) => {
|
|
39
|
+
const callbackError = {
|
|
40
|
+
name: "GeolocationError",
|
|
41
|
+
message: error.message,
|
|
42
|
+
code: error.code.toString(),
|
|
43
|
+
};
|
|
44
|
+
callback(undefined, callbackError);
|
|
45
|
+
}, {
|
|
46
|
+
enableHighAccuracy: true,
|
|
47
|
+
timeout: 10000,
|
|
48
|
+
maximumAge: options.stale ? 300000 : 0,
|
|
49
|
+
});
|
|
50
|
+
this.watchers.set(watcherId, { watchId, callback });
|
|
51
|
+
return watcherId;
|
|
52
|
+
}
|
|
53
|
+
async removeWatcher(options) {
|
|
54
|
+
const watcher = this.watchers.get(options.id);
|
|
55
|
+
if (watcher) {
|
|
56
|
+
navigator.geolocation.clearWatch(watcher.watchId);
|
|
57
|
+
this.watchers.delete(options.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async openSettings() {
|
|
61
|
+
console.log("openSettings: Web implementation cannot open native settings");
|
|
62
|
+
window.alert("Please enable location permissions in your browser settings");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
67
|
+
__proto__: null,
|
|
68
|
+
BackgroundGeolocationWeb: BackgroundGeolocationWeb
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
exports.BackgroundGeolocation = BackgroundGeolocation;
|
|
72
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.watchers = new Map();\n this.watcherCounter = 0;\n }\n async addWatcher(options, callback) {\n const watcherId = `watcher_${++this.watcherCounter}`;\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n const watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n async removeWatcher(options) {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please enable location permissions in your browser settings\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC5E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE;AACjC,QAAQ,IAAI,CAAC,cAAc,GAAG,CAAC;AAC/B,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE;AACxC,QAAQ,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAC5D,QAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AACpC,YAAY,QAAQ,CAAC,SAAS,EAAE;AAChC,gBAAgB,IAAI,EAAE,kBAAkB;AACxC,gBAAgB,OAAO,EAAE,8CAA8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AAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC3D,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;AACjC,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;AACrD,QAAQ,IAAI,OAAO,EAAE;AACrB,YAAY,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;AAC7D,YAAY,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAC5C,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF,QAAQ,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC;AACnF,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var capacitorInAppBrowser = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const BackgroundGeolocation = core.registerPlugin("BackgroundGeolocation", {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BackgroundGeolocationWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class BackgroundGeolocationWeb extends core.WebPlugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.watchers = new Map();
|
|
12
|
+
this.watcherCounter = 0;
|
|
13
|
+
}
|
|
14
|
+
async addWatcher(options, callback) {
|
|
15
|
+
const watcherId = `watcher_${++this.watcherCounter}`;
|
|
16
|
+
if (!navigator.geolocation) {
|
|
17
|
+
callback(undefined, {
|
|
18
|
+
name: "GeolocationError",
|
|
19
|
+
message: "Geolocation is not supported by this browser",
|
|
20
|
+
code: "NOT_SUPPORTED",
|
|
21
|
+
});
|
|
22
|
+
return watcherId;
|
|
23
|
+
}
|
|
24
|
+
const watchId = navigator.geolocation.watchPosition((position) => {
|
|
25
|
+
const location = {
|
|
26
|
+
latitude: position.coords.latitude,
|
|
27
|
+
longitude: position.coords.longitude,
|
|
28
|
+
accuracy: position.coords.accuracy,
|
|
29
|
+
altitude: position.coords.altitude,
|
|
30
|
+
altitudeAccuracy: position.coords.altitudeAccuracy,
|
|
31
|
+
simulated: false,
|
|
32
|
+
bearing: position.coords.heading,
|
|
33
|
+
speed: position.coords.speed,
|
|
34
|
+
time: position.timestamp,
|
|
35
|
+
};
|
|
36
|
+
callback(location);
|
|
37
|
+
}, (error) => {
|
|
38
|
+
const callbackError = {
|
|
39
|
+
name: "GeolocationError",
|
|
40
|
+
message: error.message,
|
|
41
|
+
code: error.code.toString(),
|
|
42
|
+
};
|
|
43
|
+
callback(undefined, callbackError);
|
|
44
|
+
}, {
|
|
45
|
+
enableHighAccuracy: true,
|
|
46
|
+
timeout: 10000,
|
|
47
|
+
maximumAge: options.stale ? 300000 : 0,
|
|
48
|
+
});
|
|
49
|
+
this.watchers.set(watcherId, { watchId, callback });
|
|
50
|
+
return watcherId;
|
|
51
|
+
}
|
|
52
|
+
async removeWatcher(options) {
|
|
53
|
+
const watcher = this.watchers.get(options.id);
|
|
54
|
+
if (watcher) {
|
|
55
|
+
navigator.geolocation.clearWatch(watcher.watchId);
|
|
56
|
+
this.watchers.delete(options.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async openSettings() {
|
|
60
|
+
console.log("openSettings: Web implementation cannot open native settings");
|
|
61
|
+
window.alert("Please enable location permissions in your browser settings");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
66
|
+
__proto__: null,
|
|
67
|
+
BackgroundGeolocationWeb: BackgroundGeolocationWeb
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
exports.BackgroundGeolocation = BackgroundGeolocation;
|
|
71
|
+
|
|
72
|
+
return exports;
|
|
73
|
+
|
|
74
|
+
})({}, capacitorExports);
|
|
75
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst BackgroundGeolocation = registerPlugin(\"BackgroundGeolocation\", {\n web: () => import(\"./web\").then((m) => new m.BackgroundGeolocationWeb()),\n});\nexport * from \"./definitions\";\nexport { BackgroundGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class BackgroundGeolocationWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.watchers = new Map();\n this.watcherCounter = 0;\n }\n async addWatcher(options, callback) {\n const watcherId = `watcher_${++this.watcherCounter}`;\n if (!navigator.geolocation) {\n callback(undefined, {\n name: \"GeolocationError\",\n message: \"Geolocation is not supported by this browser\",\n code: \"NOT_SUPPORTED\",\n });\n return watcherId;\n }\n const watchId = navigator.geolocation.watchPosition((position) => {\n const location = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n altitude: position.coords.altitude,\n altitudeAccuracy: position.coords.altitudeAccuracy,\n simulated: false,\n bearing: position.coords.heading,\n speed: position.coords.speed,\n time: position.timestamp,\n };\n callback(location);\n }, (error) => {\n const callbackError = {\n name: \"GeolocationError\",\n message: error.message,\n code: error.code.toString(),\n };\n callback(undefined, callbackError);\n }, {\n enableHighAccuracy: true,\n timeout: 10000,\n maximumAge: options.stale ? 300000 : 0,\n });\n this.watchers.set(watcherId, { watchId, callback });\n return watcherId;\n }\n async removeWatcher(options) {\n const watcher = this.watchers.get(options.id);\n if (watcher) {\n navigator.geolocation.clearWatch(watcher.watchId);\n this.watchers.delete(options.id);\n }\n }\n async openSettings() {\n console.log(\"openSettings: Web implementation cannot open native settings\");\n window.alert(\"Please en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,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF,QAAQ,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC;IACnF,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for Plugin.
|
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for Plugin.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Capacitor/Capacitor.h>
|
|
3
|
+
|
|
4
|
+
CAP_PLUGIN(BackgroundGeolocation, "BackgroundGeolocation",
|
|
5
|
+
CAP_PLUGIN_METHOD(addWatcher, CAPPluginReturnCallback);
|
|
6
|
+
CAP_PLUGIN_METHOD(removeWatcher, CAPPluginReturnPromise);
|
|
7
|
+
CAP_PLUGIN_METHOD(openSettings, CAPPluginReturnPromise);
|
|
8
|
+
)
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
import Foundation
|
|
3
|
+
import UIKit
|
|
4
|
+
import CoreLocation
|
|
5
|
+
|
|
6
|
+
// Avoids a bewildering type warning.
|
|
7
|
+
let null = Optional<Double>.none as Any
|
|
8
|
+
|
|
9
|
+
func formatLocation(_ location: CLLocation) -> PluginCallResultData {
|
|
10
|
+
var simulated = false
|
|
11
|
+
if #available(iOS 15, *) {
|
|
12
|
+
// Prior to iOS 15, it was not possible to detect simulated locations.
|
|
13
|
+
// But in general, it is very difficult to simulate locations on iOS in
|
|
14
|
+
// production.
|
|
15
|
+
if location.sourceInformation != nil {
|
|
16
|
+
simulated = location.sourceInformation!.isSimulatedBySoftware
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return [
|
|
20
|
+
"latitude": location.coordinate.latitude,
|
|
21
|
+
"longitude": location.coordinate.longitude,
|
|
22
|
+
"accuracy": location.horizontalAccuracy,
|
|
23
|
+
"altitude": location.altitude,
|
|
24
|
+
"altitudeAccuracy": location.verticalAccuracy,
|
|
25
|
+
"simulated": simulated,
|
|
26
|
+
"speed": location.speed < 0 ? null : location.speed,
|
|
27
|
+
"bearing": location.course < 0 ? null : location.course,
|
|
28
|
+
"time": NSNumber(
|
|
29
|
+
value: Int(
|
|
30
|
+
location.timestamp.timeIntervalSince1970 * 1000
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class Watcher {
|
|
37
|
+
let callbackId: String
|
|
38
|
+
let locationManager: CLLocationManager = CLLocationManager()
|
|
39
|
+
private let created = Date()
|
|
40
|
+
private let allowStale: Bool
|
|
41
|
+
private var isUpdatingLocation: Bool = false
|
|
42
|
+
init(_ id: String, stale: Bool) {
|
|
43
|
+
callbackId = id
|
|
44
|
+
allowStale = stale
|
|
45
|
+
}
|
|
46
|
+
func start() {
|
|
47
|
+
// Avoid unnecessary calls to startUpdatingLocation, which can
|
|
48
|
+
// result in extraneous invocations of didFailWithError.
|
|
49
|
+
if !isUpdatingLocation {
|
|
50
|
+
locationManager.startUpdatingLocation()
|
|
51
|
+
isUpdatingLocation = true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
func stop() {
|
|
55
|
+
if isUpdatingLocation {
|
|
56
|
+
locationManager.stopUpdatingLocation()
|
|
57
|
+
isUpdatingLocation = false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
func isLocationValid(_ location: CLLocation) -> Bool {
|
|
61
|
+
return (
|
|
62
|
+
allowStale ||
|
|
63
|
+
location.timestamp >= created
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@objc(BackgroundGeolocation)
|
|
69
|
+
public class BackgroundGeolocation: CAPPlugin, CLLocationManagerDelegate {
|
|
70
|
+
private var watchers = [Watcher]()
|
|
71
|
+
|
|
72
|
+
@objc override public func load() {
|
|
73
|
+
UIDevice.current.isBatteryMonitoringEnabled = true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@objc func addWatcher(_ call: CAPPluginCall) {
|
|
77
|
+
call.keepAlive = true
|
|
78
|
+
|
|
79
|
+
// CLLocationManager requires main thread
|
|
80
|
+
DispatchQueue.main.async {
|
|
81
|
+
let background = call.getString("backgroundMessage") != nil
|
|
82
|
+
let watcher = Watcher(
|
|
83
|
+
call.callbackId,
|
|
84
|
+
stale: call.getBool("stale") ?? false
|
|
85
|
+
)
|
|
86
|
+
let manager = watcher.locationManager
|
|
87
|
+
manager.delegate = self
|
|
88
|
+
let externalPower = [
|
|
89
|
+
.full,
|
|
90
|
+
.charging
|
|
91
|
+
].contains(UIDevice.current.batteryState)
|
|
92
|
+
manager.desiredAccuracy = (
|
|
93
|
+
externalPower
|
|
94
|
+
? kCLLocationAccuracyBestForNavigation
|
|
95
|
+
: kCLLocationAccuracyBest
|
|
96
|
+
)
|
|
97
|
+
var distanceFilter = call.getDouble("distanceFilter")
|
|
98
|
+
// It appears that setting manager.distanceFilter to 0 can prevent
|
|
99
|
+
// subsequent location updates. See issue #88.
|
|
100
|
+
if distanceFilter == nil || distanceFilter == 0 {
|
|
101
|
+
distanceFilter = kCLDistanceFilterNone
|
|
102
|
+
}
|
|
103
|
+
manager.distanceFilter = distanceFilter!
|
|
104
|
+
manager.allowsBackgroundLocationUpdates = background
|
|
105
|
+
manager.showsBackgroundLocationIndicator = background
|
|
106
|
+
manager.pausesLocationUpdatesAutomatically = false
|
|
107
|
+
self.watchers.append(watcher)
|
|
108
|
+
if call.getBool("requestPermissions") != false {
|
|
109
|
+
let status = CLLocationManager.authorizationStatus()
|
|
110
|
+
if [
|
|
111
|
+
.notDetermined,
|
|
112
|
+
.denied,
|
|
113
|
+
.restricted
|
|
114
|
+
].contains(status) {
|
|
115
|
+
return (
|
|
116
|
+
background
|
|
117
|
+
? manager.requestAlwaysAuthorization()
|
|
118
|
+
: manager.requestWhenInUseAuthorization()
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
if background && status == .authorizedWhenInUse {
|
|
122
|
+
// Attempt to escalate.
|
|
123
|
+
manager.requestAlwaysAuthorization()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return watcher.start()
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@objc func removeWatcher(_ call: CAPPluginCall) {
|
|
131
|
+
// CLLocationManager requires main thread
|
|
132
|
+
DispatchQueue.main.async {
|
|
133
|
+
if let callbackId = call.getString("id") {
|
|
134
|
+
if let index = self.watchers.firstIndex(
|
|
135
|
+
where: { $0.callbackId == callbackId }
|
|
136
|
+
) {
|
|
137
|
+
self.watchers[index].locationManager.stopUpdatingLocation()
|
|
138
|
+
self.watchers.remove(at: index)
|
|
139
|
+
}
|
|
140
|
+
if let savedCall = self.bridge?.savedCall(withID: callbackId) {
|
|
141
|
+
self.bridge?.releaseCall(savedCall)
|
|
142
|
+
}
|
|
143
|
+
return call.resolve()
|
|
144
|
+
}
|
|
145
|
+
return call.reject("No callback ID")
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@objc func openSettings(_ call: CAPPluginCall) {
|
|
150
|
+
DispatchQueue.main.async {
|
|
151
|
+
guard let settingsUrl = URL(
|
|
152
|
+
string: UIApplication.openSettingsURLString
|
|
153
|
+
) else {
|
|
154
|
+
return call.reject("No link to settings available")
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if UIApplication.shared.canOpenURL(settingsUrl) {
|
|
158
|
+
UIApplication.shared.open(settingsUrl, completionHandler: {
|
|
159
|
+
(success) in
|
|
160
|
+
if success {
|
|
161
|
+
return call.resolve()
|
|
162
|
+
} else {
|
|
163
|
+
return call.reject("Failed to open settings")
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
} else {
|
|
167
|
+
return call.reject("Cannot open settings")
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public func locationManager(
|
|
173
|
+
_ manager: CLLocationManager,
|
|
174
|
+
didFailWithError error: Error
|
|
175
|
+
) {
|
|
176
|
+
if let watcher = self.watchers.first(
|
|
177
|
+
where: { $0.locationManager == manager }
|
|
178
|
+
) {
|
|
179
|
+
if let call = self.bridge?.savedCall(withID: watcher.callbackId) {
|
|
180
|
+
if let clErr = error as? CLError {
|
|
181
|
+
if clErr.code == .locationUnknown {
|
|
182
|
+
// This error is sometimes sent by the manager if
|
|
183
|
+
// it cannot get a fix immediately.
|
|
184
|
+
return
|
|
185
|
+
} else if clErr.code == .denied {
|
|
186
|
+
watcher.stop()
|
|
187
|
+
return call.reject(
|
|
188
|
+
"Permission denied.",
|
|
189
|
+
"NOT_AUTHORIZED"
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return call.reject(error.localizedDescription, nil, error)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
public func locationManager(
|
|
199
|
+
_ manager: CLLocationManager,
|
|
200
|
+
didUpdateLocations locations: [CLLocation]
|
|
201
|
+
) {
|
|
202
|
+
if let location = locations.last {
|
|
203
|
+
if let watcher = self.watchers.first(
|
|
204
|
+
where: { $0.locationManager == manager }
|
|
205
|
+
) {
|
|
206
|
+
if watcher.isLocationValid(location) {
|
|
207
|
+
if let call = self.bridge?.savedCall(withID: watcher.callbackId) {
|
|
208
|
+
return call.resolve(formatLocation(location))
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
public func locationManager(
|
|
216
|
+
_ manager: CLLocationManager,
|
|
217
|
+
didChangeAuthorization status: CLAuthorizationStatus
|
|
218
|
+
) {
|
|
219
|
+
// If this method is called before the user decides on a permission, as
|
|
220
|
+
// it is on iOS 14 when the permissions dialog is presented, we ignore
|
|
221
|
+
// it.
|
|
222
|
+
if status != .notDetermined {
|
|
223
|
+
if let watcher = self.watchers.first(
|
|
224
|
+
where: { $0.locationManager == manager }
|
|
225
|
+
) {
|
|
226
|
+
return watcher.start()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capgo/background-geolocation",
|
|
3
|
+
"version": "7.0.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Receive geolocation updates even while the app is in the background.",
|
|
6
|
+
"main": "dist/plugin.cjs.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"types": "dist/esm/index.d.ts",
|
|
9
|
+
"unpkg": "dist/plugin.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"android/src/main/",
|
|
12
|
+
"android/build.gradle",
|
|
13
|
+
"dist/",
|
|
14
|
+
"ios/Plugin/",
|
|
15
|
+
"Package.swift",
|
|
16
|
+
"CapgoBackgroundGeolocation.podspec"
|
|
17
|
+
],
|
|
18
|
+
"author": "Martin Donadieu <martin@capgo.app>",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Cap-go/capacitor-inappbrowser.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Cap-go/capacitor-inappbrowser/issues"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
29
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -sdk iphoneos -scheme Plugin && cd ..",
|
|
30
|
+
"verify:iosSPM": "xcodebuild -workspace ios/Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS",
|
|
31
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
32
|
+
"verify:web": "npm run build",
|
|
33
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
34
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
35
|
+
"eslint": "eslint .",
|
|
36
|
+
"prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
|
|
37
|
+
"swiftlint": "node-swiftlint",
|
|
38
|
+
"docgen": "docgen --api BackgroundGeolocationPlugin --output-readme README.md --output-json dist/docs.json",
|
|
39
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
40
|
+
"clean": "rimraf ./dist",
|
|
41
|
+
"watch": "tsc --watch",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"capacitor",
|
|
46
|
+
"plugin",
|
|
47
|
+
"native",
|
|
48
|
+
"background",
|
|
49
|
+
"geolocation"
|
|
50
|
+
],
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@capacitor/android": "^7.0.0",
|
|
53
|
+
"@capacitor/cli": "^7.0.0",
|
|
54
|
+
"@capacitor/core": "^7.0.0",
|
|
55
|
+
"@capacitor/docgen": "^0.3.0",
|
|
56
|
+
"@capacitor/ios": "^7.0.0",
|
|
57
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
58
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
59
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
60
|
+
"@types/node": "^22.13.1",
|
|
61
|
+
"eslint": "^8.57.0",
|
|
62
|
+
"eslint-plugin-import": "^2.31.0",
|
|
63
|
+
"husky": "^9.1.7",
|
|
64
|
+
"prettier": "^3.4.2",
|
|
65
|
+
"prettier-plugin-java": "^2.6.7",
|
|
66
|
+
"rimraf": "^6.0.1",
|
|
67
|
+
"rollup": "^4.34.6",
|
|
68
|
+
"swiftlint": "^2.0.0",
|
|
69
|
+
"typescript": "^5.7.3"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@capacitor/core": ">=7.0.0"
|
|
73
|
+
},
|
|
74
|
+
"eslintConfig": {
|
|
75
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
76
|
+
},
|
|
77
|
+
"prettier": "@ionic/prettier-config",
|
|
78
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
79
|
+
"capacitor": {
|
|
80
|
+
"ios": {
|
|
81
|
+
"src": "ios"
|
|
82
|
+
},
|
|
83
|
+
"android": {
|
|
84
|
+
"src": "android"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|