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 -->
|
<!-- flutter_background_geolocation license -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.transistorsoft.locationmanager.license"
|
android:name="com.transistorsoft.locationmanager.license"
|
||||||
android:value="ddc599599cddaa61dfe5bb25c2b46f549c6d749fae5d0273297b304753e2e5e3" />
|
android:value="eyJhbGciOiJFZERTQSIsImtpZCI6ImVkMjU1MTktbWFpbi12MSJ9.eyJvcyI6ImFuZHJvaWQiLCJhcHBfaWQiOiJvcmcudHJhY2Nhci5jbGllbnQiLCJvcmRlcl9udW1iZXIiOjE0MDgzLCJyZW5ld2FsX3VybCI6Imh0dHBzOi8vc2hvcC50cmFuc2lzdG9yc29mdC5jb20vY2FydC8zMTg3NDM1NjA1MjA3MToxP25vdGU9OTQ2MSIsImN1c3RvbWVyX2lkIjo4NjE1LCJwcm9kdWN0IjoiZmx1dHRlci1iYWNrZ3JvdW5kLWdlb2xvY2F0aW9uIiwia2V5X3ZlcnNpb24iOjEsImFsbG93ZWRfc3VmZml4ZXMiOlsiLmRldiIsIi5kZXZlbG9wbWVudCIsIi5zdGFnaW5nIiwiLnN0YWdlIiwiLnFhIiwiLnVhdCIsIi50ZXN0IiwiLmRlYnVnIl0sIm1heF9idWlsZF9zdGFtcCI6MjAyNjA3MDYsImdyYWNlX2J1aWxkcyI6MCwiZW50aXRsZW1lbnRzIjpbImNvcmUiXSwiaWF0IjoxNzY1NjQyNzI2fQ.ufcC9IUak4MD7lcbB2CXIIaXHzo1xUauHIFcqyC7onBUxFcpcg2LihIk7cJGFsA_FhsHjRfkSzqQFweD1gdiCA" />
|
||||||
</application>
|
</application>
|
||||||
<!-- Required to query activities that can process text, see:
|
<!-- Required to query activities that can process text, see:
|
||||||
https://developer.android.com/training/package-visibility and
|
https://developer.android.com/training/package-visibility and
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
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;
|
final heartbeatInterval = instance.getInt(heartbeat) ?? 0;
|
||||||
return bg.Config(
|
return bg.Config(
|
||||||
isMoving: true,
|
isMoving: true,
|
||||||
enableHeadless: true,
|
geolocation: bg.GeoConfig(
|
||||||
stopOnTerminate: false,
|
desiredAccuracy: switch (instance.getString(accuracy)) {
|
||||||
startOnBoot: true,
|
'highest' => Platform.isIOS ? bg.DesiredAccuracy.navigation : bg.DesiredAccuracy.high,
|
||||||
desiredAccuracy: switch (instance.getString(accuracy)) {
|
'high' => bg.DesiredAccuracy.high,
|
||||||
'highest' => Platform.isIOS ? bg.Config.DESIRED_ACCURACY_NAVIGATION : bg.Config.DESIRED_ACCURACY_HIGH,
|
'low' => bg.DesiredAccuracy.low,
|
||||||
'high' => bg.Config.DESIRED_ACCURACY_HIGH,
|
_ => bg.DesiredAccuracy.medium,
|
||||||
'low' => bg.Config.DESIRED_ACCURACY_LOW,
|
},
|
||||||
_ => bg.Config.DESIRED_ACCURACY_MEDIUM,
|
distanceFilter: isHighestAccuracy ? 0 : instance.getInt(distance)?.toDouble(),
|
||||||
},
|
locationUpdateInterval: isHighestAccuracy ? 0 : (locationUpdateInterval > 0 ? locationUpdateInterval : null),
|
||||||
autoSync: false,
|
fastestLocationUpdateInterval: isHighestAccuracy ? 0 : fastestLocationUpdateInterval,
|
||||||
url: _formatUrl(instance.getString(url)),
|
disableElasticity: true,
|
||||||
params: {
|
pausesLocationUpdatesAutomatically: Platform.isIOS ? !(isHighestAccuracy || instance.getBool(stopDetection) == false) : null,
|
||||||
'device_id': instance.getString(id),
|
showsBackgroundLocationIndicator: false,
|
||||||
},
|
|
||||||
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'
|
|
||||||
),
|
),
|
||||||
notification: bg.Notification(
|
app: bg.AppConfig(
|
||||||
smallIcon: 'drawable/ic_stat_notify',
|
enableHeadless: true,
|
||||||
priority: bg.Config.NOTIFICATION_PRIORITY_LOW,
|
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"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.13.0"
|
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:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -250,10 +242,10 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_background_geolocation
|
name: flutter_background_geolocation
|
||||||
sha256: "6910bec29cfed37fe11972c0207411c36d26f62067f2465b22d0c1176da60f6c"
|
sha256: "506fc7d9f2a79c8f67057c1e83debe27b2f611aca464b77e0e14e3b0872db4ad"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.18.2"
|
version: "5.0.1"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ dependencies:
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
intl: any
|
intl: any
|
||||||
flutter_background_geolocation: ^4.18.2
|
flutter_background_geolocation: ^5.0.0
|
||||||
shared_preferences: ^2.5.4
|
shared_preferences: ^2.5.4
|
||||||
firebase_core: ^4.3.0
|
firebase_core: ^4.3.0
|
||||||
firebase_messaging: ^16.1.0
|
firebase_messaging: ^16.1.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue