@capgo/background-geolocation 8.0.5 → 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.
|
|
126
|
-
|
|
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
|
}
|
package/ios/Sources/CapgoBackgroundGeolocationPlugin/CapgoCapacitorBackgroundGeolocationPlugin.swift
CHANGED
|
@@ -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.
|
|
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