@capgo/background-geolocation 7.0.11 → 7.0.14

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.
@@ -51,7 +51,9 @@ public class BackgroundGeolocationService extends Service {
51
51
  // service is terminated immediately.
52
52
  @Override
53
53
  public boolean onUnbind(Intent intent) {
54
- client.removeUpdates(locationCallback);
54
+ if (client != null && locationCallback != null) {
55
+ client.removeUpdates(locationCallback);
56
+ }
55
57
  releaseMediaPlayer();
56
58
  stopSelf();
57
59
  return false;
@@ -59,7 +61,9 @@ public class BackgroundGeolocationService extends Service {
59
61
 
60
62
  @Override
61
63
  public void onDestroy() {
62
- client.removeUpdates(locationCallback);
64
+ if (client != null && locationCallback != null) {
65
+ client.removeUpdates(locationCallback);
66
+ }
63
67
  super.onDestroy();
64
68
  releaseMediaPlayer();
65
69
  }
@@ -159,14 +159,12 @@ public class BackgroundGeolocation: CAPPlugin, CLLocationManagerDelegate {
159
159
  DispatchQueue.global(qos: .background).async { [weak self] in
160
160
  guard let self = self else { return }
161
161
 
162
- // Get the sound file path
163
162
  guard let soundFile = call.getString("soundFile") else {
164
163
  call.reject("Sound file is required")
165
164
  return
166
165
  }
167
166
 
168
- // Get the route array
169
- let routeArray = call.getArray("route", JSObject.self) ?? []
167
+ let routeArray = call.getArray("route", Any.self) ?? []
170
168
  var route: [[Double]] = []
171
169
 
172
170
  for routePoint in routeArray {
@@ -175,10 +173,8 @@ public class BackgroundGeolocation: CAPPlugin, CLLocationManagerDelegate {
175
173
  }
176
174
  }
177
175
 
178
- // Get distance threshold
179
176
  let distance = call.getDouble("distance") ?? 50.0
180
177
 
181
- // Set up audio player
182
178
  let assetPath = "public/" + soundFile
183
179
  let assetPathSplit = assetPath.components(separatedBy: ".")
184
180
  guard let url = Bundle.main.url(forResource: assetPathSplit[0], withExtension: assetPathSplit[1]) else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/background-geolocation",
3
- "version": "7.0.11",
3
+ "version": "7.0.14",
4
4
  "description": "Receive geolocation updates even while the app is in the background.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -18,10 +18,10 @@
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/Cap-go/background-geolocation.git"
21
+ "url": "git+https://github.com/Cap-go/capacitor-background-geolocation.git"
22
22
  },
23
23
  "bugs": {
24
- "url": "https://github.com/Cap-go/background-geolocation/issues"
24
+ "url": "https://github.com/Cap-go/capacitor-background-geolocation/issues"
25
25
  },
26
26
  "scripts": {
27
27
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",