transistorsoft / transistorsoft/flutter_background_geolocation
[Bug]: TrackingService stops after startId 10000 on some phones.
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 732
- Forks
- 285
- PR merge metrics
- No merged PRs in 30d
Description
Required Reading
- Confirmed
Plugin Version
5.5.0
Flutter Doctor
[√] Flutter (Channel stable, 3.44.8, on Microsoft Windows [Version 10.0.26200.8875], locale en-US) [318ms]
• Flutter version 3.44.8 on channel stable at c:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 058e0af2c2 (2 weeks ago), 2026-07-23 10:56:21 -0700
• Engine revision 0cd610717b
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[√] Windows Version (Windows 11 or higher, 25H2, 2009) [920ms]
[√] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [5.5s]
• Android SDK at c:\Users\john\AppData\Local\Android\Sdk
• Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
• Platform android-37.0, build-tools 37.0.0
• ANDROID_HOME = c:\Users\john\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
• All Android licenses accepted.
[√] Chrome - develop for the web [125ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2026 18.5.2) [124ms]
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools
• Visual Studio Build Tools 2026 version 18.5.11723.231
• Windows 10 SDK version 10.0.26100.0
[√] Connected device (4 available) [330ms]
• Pixel 7 (mobile) • 29161FDH2008WY • android-arm64 • Android 17 (API 37)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.8875]
• Chrome (web) • chrome • web-javascript • Google Chrome 150.0.7871.128
• Edge (web) • edge • web-javascript • Microsoft Edge 151.0.4129.59
[√] Network resources [453ms]
• All expected network resources are available.
• No issues found!
PS C:\Users\john\source\repos\SuperCycle> flutter doctor --verbose
[√] Flutter (Channel stable, 3.44.8, on Microsoft Windows [Version 10.0.26200.8875], locale en-US) [286ms]
• Flutter version 3.44.8 on channel stable at c:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 058e0af2c2 (2 weeks ago), 2026-07-23 10:56:21 -0700
• Engine revision 0cd610717b
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[√] Windows Version (Windows 11 or higher, 25H2, 2009) [1,491ms]
[√] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [1,501ms]
• Android SDK at c:\Users\john\AppData\Local\Android\Sdk
• Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
• Platform android-37.0, build-tools 37.0.0
• ANDROID_HOME = c:\Users\john\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
• All Android licenses accepted.
[√] Chrome - develop for the web [106ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2026 18.5.2) [105ms]
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools
• Visual Studio Build Tools 2026 version 18.5.11723.231
• Windows 10 SDK version 10.0.26100.0
[√] Connected device (4 available) [337ms]
• Pixel 7 (mobile) • 29161FDH2008WY • android-arm64 • Android 17 (API 37)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.8875]
• Chrome (web) • chrome • web-javascript • Google Chrome 150.0.7871.128
• Edge (web) • edge • web-javascript • Microsoft Edge 151.0.4129.59
[√] Network resources [322ms]
• All expected network resources are available.
• No issues found!
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
Cubot KingKong Mini 4, Motorola Moto G14, and Infinix Note 60
Device operating-systems(s)
Android 15 and 16.
What happened?
After the startId reaches 10000, the TrackingService stops, but I only know of it happening on the listed phones. On my Pixel 10 Pro, startId goes well beyond 10000 (I stopped one test at over 63000), and it never fails. It could be that this is related to the firmware for particular chipsets. The chipsets are UnisocTiger T616 and MediaTek Dimensity 7400 Ultimate. There is no crash, but no further location updates are received. The included log file events are a subset; I can send you the entire log. The user performed the same test using Jepster, and it never fails.
Plugin Code and/or Config
bg.Config _getBgConfig({
required bool isMoving,
required bool isLoggingEnabled,
}) {
_log.info('_getBgConfig');
var localize = Localizer.instance.localize;
bool aggressive = locationMonitor == LocationMonitor.aggressive;
return bg.Config(
reset: true,
isMoving: isMoving,
geolocation: bg.GeoConfig(
desiredAccuracy: notifier.isStationaryBike
? bg.DesiredAccuracy.lowest
: bg.DesiredAccuracy.high,
distanceFilter: aggressive ? 0.0 : 5.0,
locationUpdateInterval: aggressive ? 1000 : null,
disableElasticity: false,
elasticityMultiplier: 1.0,
pausesLocationUpdatesAutomatically: false,
showsBackgroundLocationIndicator: true,
locationAuthorizationRequest: Platform.isAndroid
? 'WhenInUse'
: 'Always',
stopTimeout: 60 * 24 * 5,
),
app: bg.AppConfig(
preventSuspend: notifier.isStationaryBike,
heartbeatInterval: Platform.isAndroid
? null
: (notifier.isStationaryBike ? 30 : null),
stopOnTerminate: true,
startOnBoot: false,
backgroundPermissionRationale: Platform.isAndroid
? null
: bg.PermissionRationale(
title: localize.dlgBackgroundLocationPermissionTitle(
'{applicationName}',
),
message: localize.dlgBackgroundLocationPermissionContent(
'{backgroundPermissionOptionLabel}',
),
positiveAction: localize.dlgBackgroundLocationPermissionAction1(
'{backgroundPermissionOptionLabel}',
),
negativeAction: localize.dlgBackgroundLocationPermissionAction2,
),
),
logger: bg.LoggerConfig(
logLevel: isLoggingEnabled ? bg.LogLevel.verbose : bg.LogLevel.off,
logMaxDays: 1,
),
activity: bg.ActivityConfig(
disableStopDetection: true,
stopOnStationary: false,
),
);
}
Relevant log output
The log is reverse chronological order:
⚠️ 🛃 GATE WATCHDOG force-reopen epoch=10469 ready=0/1 missing=[TrackingService]
08-05 14:01:53.809 ERROR [FgsLaunchGate scheduleGateWatchdog[λ]]
⚠️ 🛃 GATE WATCHDOG force-reopen epoch=10468 ready=0/1 missing=[TrackingService]
⚙️︎ FINISH [TrackingService startId: 10001, eventCount: 0, sticky: true]
08-05 10:17:01.925 DEBUG [TSLocationManager onLocationResult]
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════
08-05 10:17:01.925 DEBUG [TSLocationManager onLocationResult] LocationFilterResult: LocationFilterResult{decision=ACCEPTED, reason='ok', selected=1.0105855642517493E-265, raw=9.137452125549316, effective=0.0, anomaly=false, acc(cur)=32.349, acc(prev)=33.693}
08-05 10:17:01.924 DEBUG [TrackingService e]
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 48****** , 17****** hAcc=32.349 et=+6d15h33m33s807ms alt=208.70001220703125 vAcc=2.1640651 vel=2.256512 sAcc=2.2027915 bear=207.59206 bAcc=76.63302]
╟─ Age: 64ms, time: 1785917821858
08-05 10:17:01.922 DEBUG [AbstractService a]
🎾 start [TrackingService startId: 10001, eventCount: 1]
08-05 10:17:01.266 INFO [BackgroundGeolocationModule log]
ℹ️ GpsHandler: _updatePosition - accFilterEnabled=false, acc=33.69, sample=false
08-05 10:17:01.265 INFO [BackgroundGeolocationModule log]
ℹ️ GpsHandler: _onBgLocation - acc=33.69
08-05 10:17:01.262 INFO [c0 a]
💾 ✅ 45ee226b-9bfb-43f2-adb6-9a349dff01c3
08-05 10:17:01.260 DEBUG [EventManager c] 🛜 ⚡️ location
08-05 10:17:01.258 DEBUG [TSLocationManager onLocationResult] LocationFilterResult: LocationFilterResult{decision=ACCEPTED, reason='ok', selected=1.0600520981508038E-265, raw=6.810371398925781, effective=0.0, anomaly=false, acc(cur)=33.693, acc(prev)=33.365}
08-05 10:17:01.257 DEBUG [TrackingService e]
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 48****** , 17****** hAcc=33.693 et=+6d15h33m33s130ms alt=208.70001220703125 vAcc=2.1540875 vel=2.4819293 sAcc=2.4868052 bear=285.70795 bAcc=108.79977]
╟─ Age: 74ms, time: 1785917821181
08-05 10:17:01.257 DEBUG [AbstractService a]
⚙️︎ FINISH [TrackingService startId: 10000, eventCount: 0, sticky: true]
08-05 10:17:01.257 DEBUG [TSLocationManager onLocationResult]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the _getBgConfig entry point and the TrackingService log entries around startId 10000 and 10001, then trace how the Android service finishes and restarts. Reproduce on the listed Android devices and compare the behavior with the Pixel test; done means location updates continue past startId 10000 without the watchdog reporting a missing TrackingService.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart
- Domain
- mobile, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100