Required Reading
Plugin Version
5.1.2
Flutter Doctor
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.41.7, on macOS 26.3.1 25D2128 darwin-arm64, locale en-US)
• Flutter version 3.41.7 on channel stable
• Framework revision cc0734ac71 (3 weeks ago), 2026-04-15
• Engine revision 59aa584fdf
• Dart version 3.11.5
• DevTools version 2.54.2
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
• Android SDK at /Users/lucas/Library/Android/sdk
• Platform android-36, build-tools 36.0.0
• Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.4.1)
• Build 17E202
• CocoaPods version 1.16.2
[✓] Connected device (5 available)
• Pixel 9 (mobile) • android-arm64 • Android 16 (API 36)
[✓] Network resources
• No issues found!
Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
Google Pixel 9
Device operating-systems(s)
Android 16
What happened?
With no source change, the Android app started crashing on launch — Gradle resolved the freshly published tslocationmanager 4.1.5 (the plugin declares the floating range 4.1.+).
TSLocationManager.buildLocationRequest() ends up calling LocationRequest.setPriority(-1), and play-services-location 21.x rejects it:
java.lang.IllegalArgumentException: priority -1 must be a Priority.PRIORITY_* constant
The -1 is the Dart-side DESIRED_ACCURACY_HIGH constant. In 4.1.3, GeoState.androidDesiredAccuracy() always ran it through AccuracyTranslator.toAndroid (-1 → 100). In 4.1.5, that translation is gated on a new useCLLocationAccuracy flag that is false by default, so the raw -1 reaches setPriority.
Expected: desiredAccuracy: DesiredAccuracy.high should map to Priority.PRIORITY_HIGH_ACCURACY (100), as in 4.1.3.
Workaround: pinning tslocationmanagerVersion = "4.1.3" in android/build.gradle.kts restores the pre-regression behavior.
Plugin Code and/or Config
bg.GeoConfig _buildGeoConfig() {
if (defaultTargetPlatform == TargetPlatform.android) {
return bg.GeoConfig(
desiredAccuracy: bg.DesiredAccuracy.high, // = Config.DESIRED_ACCURACY_HIGH = -1
disableLocationAuthorizationAlert: true,
showsBackgroundLocationIndicator: false,
locationAuthorizationRequest: 'Any',
distanceFilter: 50,
);
}
return bg.GeoConfig(
desiredAccuracy: bg.DesiredAccuracy.high,
disableLocationAuthorizationAlert: true,
showsBackgroundLocationIndicator: false,
locationAuthorizationRequest: 'Any',
distanceFilter: 50,
);
}
bg.AppConfig _buildAppConfig() {
if (defaultTargetPlatform == TargetPlatform.android) {
return bg.AppConfig(
enableHeadless: true,
stopOnTerminate: false,
startOnBoot: true,
notification: bg.Notification(
title: 'JobSnap',
text: 'Running in the background to keep your time accurate',
smallIcon: 'drawable/notif_icon',
largeIcon: 'drawable/notif_icon',
),
backgroundPermissionRationale: bg.PermissionRationale(
title: 'Enable Auto Clock In/Out with GPS.',
message: 'To reliably clock you in and out, please enable '
'{backgroundPermissionOptionLabel} location permission',
positiveAction: 'Change to {backgroundPermissionOptionLabel}',
negativeAction: 'Cancel',
),
);
}
return bg.AppConfig(stopOnTerminate: false, startOnBoot: true);
}
await bg.BackgroundGeolocation.ready(
bg.Config(
reset: true,
foregroundService: true,
extras: {'user_id': userId},
geolocation: _buildGeoConfig(),
app: _buildAppConfig(),
logger: bg.LoggerConfig(
debug: kDebugMode,
logLevel: bg.LogLevel.debug,
logMaxDays: 7,
),
),
);
Relevant log output
Cold-launch crash via `FgsLaunchGate.handleColdLaunch` — clearest single trace:
05-07 22:13:15.740 19130 19130 E AndroidRuntime: FATAL EXCEPTION: main
05-07 22:13:15.740 19130 19130 E AndroidRuntime: Process: app.swx.jobsnap, PID: 19130
05-07 22:13:15.740 19130 19130 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.transistorsoft.locationmanager.service.FgsLaunchGate
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:5335)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2741)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at android.os.Looper.loop(Looper.java:367)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:9333)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: priority -1 must be a Priority.PRIORITY_* constant
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.google.android.gms.common.internal.K.b(SourceFile:10)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at h4.F.b(SourceFile:31)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.buildLocationRequest(SourceFile:83)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.requestLocationUpdates(SourceFile:53)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.service.TrackingService.e(SourceFile:24)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.d(SourceFile:20)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.b(SourceFile:4)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.getInstance(SourceFile:3)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.service.FgsLaunchGate.handleColdLaunch(SourceFile:24)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at com.transistorsoft.locationmanager.service.FgsLaunchGate.onReceive(SourceFile:73)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:5328)
05-07 22:13:15.740 19130 19130 E AndroidRuntime: ... 10 more
Same `IllegalArgumentException` also fires from the foreground/background callback paths:
05-07 22:13:17.432 19197 19197 E AndroidRuntime: FATAL EXCEPTION: main
05-07 22:13:17.432 19197 19197 E AndroidRuntime: Process: app.swx.jobsnap, PID: 19197
05-07 22:13:17.432 19197 19197 E AndroidRuntime: java.lang.IllegalArgumentException: priority -1 must be a Priority.PRIORITY_* constant
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.google.android.gms.common.internal.K.b(SourceFile:10)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at h4.F.b(SourceFile:31)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.buildLocationRequest(SourceFile:83)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.requestLocationUpdates(SourceFile:53)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.onSingleLocationResult(SourceFile:433)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager$1.onLocation(SourceFile:22)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.TSLocationManager.a(SourceFile:16)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.transistorsoft.locationmanager.location.g.onSuccess(SourceFile:1)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at com.google.android.gms.tasks.zzm.run(SourceFile:24)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:1095)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at android.os.Looper.loop(Looper.java:367)
05-07 22:13:17.432 19197 19197 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:9333)
Crash repeats until Android's `ActivityManager` flags the app as "crashed too many times, killing":
05-08 09:26:46.787 1875 2575 W ActivityManager: Process app.swx.jobsnap has crashed too many times, killing! Reason: crashed quickly
05-08 09:26:46.798 1875 2575 I ActivityManager: Killing 25128:app.swx.jobsnap/u0a650 (adj 200): crash
05-08 09:26:46.806 1875 2575 W ActivityManager: Scheduling restart of crashed service app.swx.jobsnap/com.transistorsoft.locationmanager.service.TrackingService in 3600000ms for start-requested
Required Reading
Plugin Version
5.1.2
Flutter Doctor
$ flutter doctor -v [✓] Flutter (Channel stable, 3.41.7, on macOS 26.3.1 25D2128 darwin-arm64, locale en-US) • Flutter version 3.41.7 on channel stable • Framework revision cc0734ac71 (3 weeks ago), 2026-04-15 • Engine revision 59aa584fdf • Dart version 3.11.5 • DevTools version 2.54.2 [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) • Android SDK at /Users/lucas/Library/Android/sdk • Platform android-36, build-tools 36.0.0 • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 26.4.1) • Build 17E202 • CocoaPods version 1.16.2 [✓] Connected device (5 available) • Pixel 9 (mobile) • android-arm64 • Android 16 (API 36) [✓] Network resources • No issues found!Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
Google Pixel 9
Device operating-systems(s)
Android 16
What happened?
With no source change, the Android app started crashing on launch — Gradle resolved the freshly published
tslocationmanager 4.1.5(the plugin declares the floating range4.1.+).TSLocationManager.buildLocationRequest()ends up callingLocationRequest.setPriority(-1), andplay-services-location 21.xrejects it:The
-1is the Dart-sideDESIRED_ACCURACY_HIGHconstant. In4.1.3,GeoState.androidDesiredAccuracy()always ran it throughAccuracyTranslator.toAndroid(-1 → 100). In4.1.5, that translation is gated on a newuseCLLocationAccuracyflag that isfalseby default, so the raw-1reachessetPriority.Expected:
desiredAccuracy: DesiredAccuracy.highshould map toPriority.PRIORITY_HIGH_ACCURACY(100), as in4.1.3.Workaround: pinning
tslocationmanagerVersion = "4.1.3"inandroid/build.gradle.ktsrestores the pre-regression behavior.Plugin Code and/or Config
Relevant log output