Upgrade background location lib
This commit is contained in:
parent
f4f597790a
commit
005eb0ece7
5 changed files with 51 additions and 51 deletions
|
|
@ -44,7 +44,7 @@
|
|||
<!-- flutter_background_geolocation license -->
|
||||
<meta-data
|
||||
android:name="com.transistorsoft.locationmanager.license"
|
||||
android:value="ddc599599cddaa61dfe5bb25c2b46f549c6d749fae5d0273297b304753e2e5e3" />
|
||||
android:value="eyJhbGciOiJFZERTQSIsImtpZCI6ImVkMjU1MTktbWFpbi12MSJ9.eyJvcyI6ImFuZHJvaWQiLCJhcHBfaWQiOiJvcmcudHJhY2Nhci5jbGllbnQiLCJvcmRlcl9udW1iZXIiOjE0MDgzLCJyZW5ld2FsX3VybCI6Imh0dHBzOi8vc2hvcC50cmFuc2lzdG9yc29mdC5jb20vY2FydC8zMTg3NDM1NjA1MjA3MToxP25vdGU9OTQ2MSIsImN1c3RvbWVyX2lkIjo4NjE1LCJwcm9kdWN0IjoiZmx1dHRlci1iYWNrZ3JvdW5kLWdlb2xvY2F0aW9uIiwia2V5X3ZlcnNpb24iOjEsImFsbG93ZWRfc3VmZml4ZXMiOlsiLmRldiIsIi5kZXZlbG9wbWVudCIsIi5zdGFnaW5nIiwiLnN0YWdlIiwiLnFhIiwiLnVhdCIsIi50ZXN0IiwiLmRlYnVnIl0sIm1heF9idWlsZF9zdGFtcCI6MjAyNjA3MDYsImdyYWNlX2J1aWxkcyI6MCwiZW50aXRsZW1lbnRzIjpbImNvcmUiXSwiaWF0IjoxNzY1NjQyNzI2fQ.ufcC9IUak4MD7lcbB2CXIIaXHzo1xUauHIFcqyC7onBUxFcpcg2LihIk7cJGFsA_FhsHjRfkSzqQFweD1gdiCA" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ allprojects {
|
|||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// [required] background_geolocation
|
||||
maven(url = "${project(":flutter_background_geolocation").projectDir}/libs")
|
||||
// [required] background_fetch
|
||||
maven(url = "${project(":background_fetch").projectDir}/libs")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,43 +79,55 @@ class Preferences {
|
|||
final heartbeatInterval = instance.getInt(heartbeat) ?? 0;
|
||||
return bg.Config(
|
||||
isMoving: true,
|
||||
enableHeadless: true,
|
||||
stopOnTerminate: false,
|
||||
startOnBoot: true,
|
||||
desiredAccuracy: switch (instance.getString(accuracy)) {
|
||||
'highest' => Platform.isIOS ? bg.Config.DESIRED_ACCURACY_NAVIGATION : bg.Config.DESIRED_ACCURACY_HIGH,
|
||||
'high' => bg.Config.DESIRED_ACCURACY_HIGH,
|
||||
'low' => bg.Config.DESIRED_ACCURACY_LOW,
|
||||
_ => bg.Config.DESIRED_ACCURACY_MEDIUM,
|
||||
},
|
||||
autoSync: false,
|
||||
url: _formatUrl(instance.getString(url)),
|
||||
params: {
|
||||
'device_id': instance.getString(id),
|
||||
},
|
||||
distanceFilter: isHighestAccuracy ? 0 : instance.getInt(distance)?.toDouble(),
|
||||
locationUpdateInterval: isHighestAccuracy ? 0 : (locationUpdateInterval > 0 ? locationUpdateInterval : null),
|
||||
heartbeatInterval: heartbeatInterval > 0 ? heartbeatInterval : null,
|
||||
maxRecordsToPersist: instance.getBool(buffer) != false ? -1 : 1,
|
||||
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
|
||||
logMaxDays: 1,
|
||||
locationTemplate: _locationTemplate(),
|
||||
preventSuspend: heartbeatInterval > 0,
|
||||
disableElasticity: true,
|
||||
disableStopDetection: instance.getBool(stopDetection) == false,
|
||||
pausesLocationUpdatesAutomatically: Platform.isIOS ? !(isHighestAccuracy || instance.getBool(stopDetection) == false) : null,
|
||||
fastestLocationUpdateInterval: isHighestAccuracy ? 0 : fastestLocationUpdateInterval,
|
||||
backgroundPermissionRationale: bg.PermissionRationale(
|
||||
title: 'Allow {applicationName} to access this device\'s location in the background',
|
||||
message: 'For reliable tracking, please enable {backgroundPermissionOptionLabel} location access.',
|
||||
positiveAction: 'Change to {backgroundPermissionOptionLabel}',
|
||||
negativeAction: 'Cancel'
|
||||
geolocation: bg.GeoConfig(
|
||||
desiredAccuracy: switch (instance.getString(accuracy)) {
|
||||
'highest' => Platform.isIOS ? bg.DesiredAccuracy.navigation : bg.DesiredAccuracy.high,
|
||||
'high' => bg.DesiredAccuracy.high,
|
||||
'low' => bg.DesiredAccuracy.low,
|
||||
_ => bg.DesiredAccuracy.medium,
|
||||
},
|
||||
distanceFilter: isHighestAccuracy ? 0 : instance.getInt(distance)?.toDouble(),
|
||||
locationUpdateInterval: isHighestAccuracy ? 0 : (locationUpdateInterval > 0 ? locationUpdateInterval : null),
|
||||
fastestLocationUpdateInterval: isHighestAccuracy ? 0 : fastestLocationUpdateInterval,
|
||||
disableElasticity: true,
|
||||
pausesLocationUpdatesAutomatically: Platform.isIOS ? !(isHighestAccuracy || instance.getBool(stopDetection) == false) : null,
|
||||
showsBackgroundLocationIndicator: false,
|
||||
),
|
||||
notification: bg.Notification(
|
||||
smallIcon: 'drawable/ic_stat_notify',
|
||||
priority: bg.Config.NOTIFICATION_PRIORITY_LOW,
|
||||
app: bg.AppConfig(
|
||||
enableHeadless: true,
|
||||
stopOnTerminate: false,
|
||||
startOnBoot: true,
|
||||
heartbeatInterval: heartbeatInterval > 0 ? heartbeatInterval.toDouble() : null,
|
||||
preventSuspend: heartbeatInterval > 0,
|
||||
backgroundPermissionRationale: bg.PermissionRationale(
|
||||
title: 'Allow {applicationName} to access this device\'s location in the background',
|
||||
message: 'For reliable tracking, please enable {backgroundPermissionOptionLabel} location access.',
|
||||
positiveAction: 'Change to {backgroundPermissionOptionLabel}',
|
||||
negativeAction: 'Cancel'
|
||||
),
|
||||
notification: bg.Notification(
|
||||
smallIcon: 'drawable/ic_stat_notify',
|
||||
priority: bg.NotificationPriority.low,
|
||||
),
|
||||
),
|
||||
http: bg.HttpConfig(
|
||||
autoSync: false,
|
||||
url: _formatUrl(instance.getString(url)),
|
||||
params: {
|
||||
'device_id': instance.getString(id),
|
||||
},
|
||||
),
|
||||
logger: const bg.LoggerConfig(
|
||||
logLevel: bg.LogLevel.verbose,
|
||||
logMaxDays: 1,
|
||||
),
|
||||
activity: bg.ActivityConfig(
|
||||
disableStopDetection: instance.getBool(stopDetection) == false,
|
||||
),
|
||||
persistence: bg.PersistenceConfig(
|
||||
maxRecordsToPersist: instance.getBool(buffer) != false ? -1 : 1,
|
||||
locationTemplate: _locationTemplate(),
|
||||
),
|
||||
showsBackgroundLocationIndicator: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
12
pubspec.lock
12
pubspec.lock
|
|
@ -65,14 +65,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
background_fetch:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: background_fetch
|
||||
sha256: "6f0cec85480eac151f3971f883180d8c0acf6b40001153f1cf7c2c453df4f851"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -250,10 +242,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_background_geolocation
|
||||
sha256: "6910bec29cfed37fe11972c0207411c36d26f62067f2465b22d0c1176da60f6c"
|
||||
sha256: "506fc7d9f2a79c8f67057c1e83debe27b2f611aca464b77e0e14e3b0872db4ad"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.18.2"
|
||||
version: "5.0.1"
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ dependencies:
|
|||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: any
|
||||
flutter_background_geolocation: ^4.18.2
|
||||
flutter_background_geolocation: ^5.0.0
|
||||
shared_preferences: ^2.5.4
|
||||
firebase_core: ^4.3.0
|
||||
firebase_messaging: ^16.1.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue