[Bug]: The app stops tracking if the phone has 'Remove permissions if app isn't used' enabled. most of the phones have that feature as enabled by default.
Required Reading
- [x] Confirmed
Plugin Version
4.16.9
Flutter Doctor
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.4, on macOS 15.3.1 24D70 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.100.1)
[✓] VS Code (version 1.101.0-insider)
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!
Mobile operating-system(s)
- [ ] iOS
- [x] Android
Device Manufacturer(s) and Model(s)
vivo y72 5G
Device operating-systems(s)
Android 13
What happened?
Dear Sir/Madam,
Most of the devices have this feature as default. and hence the app stops tracking once killed from background.
Plugin Code and/or Config
bg.BackgroundGeolocation.onMotionChange((bg.Location location) {
log('[motionchange] - ${location}');
});
// Fired whenever the state of location-services changes. Always fired at boot
bg.BackgroundGeolocation.onProviderChange((bg.ProviderChangeEvent event) {
log('[providerchange] - $event');
});
bg.BackgroundGeolocation.registerHeadlessTask(
backgroundGeolocationHeadlessTask);
bg.Config bgConfig = bg.Config(
desiredAccuracy: bg.Config.DESIRED_ACCURACY_MEDIUM,
stopOnTerminate: false,
startOnBoot: true,
preventSuspend: true,
debug: false,
enableHeadless: true,
autoSync: true,
batchSync: true,
allowIdenticalLocations: true,
disableAutoSyncOnCellular: false,
notification: new bg.Notification(
title: "myHisaab",
text: "Your location is being tracked during the punched phase"),
notificationTitle: 'myHisaab',
notificationText:
'Your location is being tracked during the punched phase',
foregroundService: true,
showsBackgroundLocationIndicator: true,
forceReloadOnBoot: true,
url:"$SERVER_URL_STRING",
logLevel: bg.Config.LOG_LEVEL_OFF);
await bg.BackgroundGeolocation.ready(bgConfig).then((bg.State state) async {
print('[ready] BackgroundGeolocation is configured and ready to use');
await bg.BackgroundGeolocation.start();
bg.BackgroundGeolocation.sync();
return;
});
Relevant log output
The app tracks for sometime but then stops. after 5-10 minutes.
What would you expect the plug-in to do I this case?
Alright so, i'm not sure what happened but i disabled the ''Remove permissions if app isn't used'. it has to do something with the device and the plugin. because in the normal work manager, it's working. but using this package it is not. PLease look into it and fix it.
What exactly are you expecting the plug-in to do with respect to the system setting “Remove permissions if app isn't used”?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.