@capgo/background-geolocation 8.0.4 → 8.0.6

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.
@@ -5,6 +5,7 @@ import android.app.PendingIntent;
5
5
  import android.app.Service;
6
6
  import android.content.Context;
7
7
  import android.content.Intent;
8
+ import android.content.pm.ServiceInfo;
8
9
  import android.content.res.AssetFileDescriptor;
9
10
  import android.content.res.AssetManager;
10
11
  import android.graphics.Color;
@@ -122,8 +123,16 @@ public class BackgroundGeolocationService extends Service {
122
123
  try {
123
124
  // This method has been known to fail due to weird
124
125
  // permission bugs, so we prevent any exceptions from
125
- // crashing the app. See issue #86.
126
- startForeground(NOTIFICATION_ID, createBackgroundNotification(notificationTitle, notificationMessage));
126
+ // crashing the app.
127
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
128
+ startForeground(
129
+ NOTIFICATION_ID,
130
+ createBackgroundNotification(notificationTitle, notificationMessage),
131
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
132
+ );
133
+ } else {
134
+ startForeground(NOTIFICATION_ID, createBackgroundNotification(notificationTitle, notificationMessage));
135
+ }
127
136
  } catch (Exception exception) {
128
137
  Logger.error("Failed to foreground service", exception);
129
138
  }
@@ -38,7 +38,7 @@ func formatLocation(_ location: CLLocation) -> PluginCallResultData {
38
38
  @objc(BackgroundGeolocation)
39
39
  // swiftlint:disable:next type_body_length
40
40
  public class BackgroundGeolocation: CAPPlugin, CLLocationManagerDelegate, CAPBridgedPlugin {
41
- private let pluginVersion: String = "8.0.4"
41
+ private let pluginVersion: String = "8.0.6"
42
42
  public let identifier = "BackgroundGeolocationPlugin"
43
43
  public let jsName = "BackgroundGeolocation"
44
44
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/background-geolocation",
3
- "version": "8.0.4",
3
+ "version": "8.0.6",
4
4
  "description": "Receive accurate geolocation updates even while the app is in the background.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -61,7 +61,7 @@
61
61
  "@ionic/eslint-config": "^0.4.0",
62
62
  "@ionic/prettier-config": "^4.0.0",
63
63
  "@ionic/swiftlint-config": "^2.0.0",
64
- "@types/node": "^24.10.1",
64
+ "@types/node": "^25.0.0",
65
65
  "eslint": "^8.57.1",
66
66
  "eslint-plugin-import": "^2.31.0",
67
67
  "husky": "^9.1.7",