[Help Wanted]: I have a problem with no tracking when I uninstall the app and reinstall it and every time I reinstall it I call BackgroundGeolocation.ready
Required Reading
- [x] Confirmed
Plugin Version
flutter_background_geolocation: ^4.16.9
Mobile operating-system(s)
- [ ] iOS
- [x] Android
Device Manufacturer(s) and Model(s)
SAMSUNG A53
Device operating-systems(s)
android 14
What do you require assistance about?
I use your package in my application, every time I log in it will call the initialize package function, but I'm having a problem that when I uninstall the app and reinstall it many times, sometimes I won't receive any events from the package, I think there is a problem with my implementation or your package has some problems.
[Optional] Plugin Code and/or Config
Future<void> initialize(ResponseUserInfo user) async {
try {
// Đăng ký các sự kiện
bg.BackgroundGeolocation.onLocation(_onLocation);
bg.BackgroundGeolocation.onMotionChange(_onMotionChange);
bg.BackgroundGeolocation.onActivityChange(_onActivityChange);
bg.BackgroundGeolocation.onProviderChange(_onProviderChange);
bg.BackgroundGeolocation.onPowerSaveChange(_onPowerSaveChange);
// Cấu hình tối thiểu cho Background Geolocation
bg.BackgroundGeolocation.ready(bg.Config(
// schedule: ['1-7 08:00-18:00'],
reset: false,
debug: false,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
// stopTimeout: 2,
distanceFilter: 15,
activityRecognitionInterval: 2000,
// disableElasticity: false,
locationUpdateInterval: 2000,
fastestLocationUpdateInterval: 1000,
autoSync: true,
minimumActivityRecognitionConfidence: 60,
// activityType: bg.Config.ACTIVITY_TYPE_OTHER_NAVIGATION,
stopOnTerminate: false,
notification: bg.Notification(
title: "GreenMove",
text: 'Service de localisation activé',
channelName: "Détection d'Activité",
),
startOnBoot: true,
enableHeadless: true,
persistMode: bg.Config.PERSIST_MODE_NONE,
heartbeatInterval: 60,
pausesLocationUpdatesAutomatically: false,
backgroundPermissionRationale: bg.PermissionRationale(
title:
"Autoriser {applicationName} à accéder à la localisation de cet appareil.",
message:
"L'application vous aide à gérer et à enregistrer vos trajets de manière pratique.",
positiveAction: 'Toujours autoriser',
negativeAction: 'Annuler')))
.then((bg.State state) async {
if (!state.enabled) {
await bg.BackgroundGeolocation.start();
}
// if (state.schedule!.isNotEmpty) {
// bg.BackgroundGeolocation.startSchedule();
// }
}).catchError((error) {});
} catch (e) {
rethrow;
}
}
[Optional] Relevant log output
@christocracy help me
See wiki “Debugging”. Learn to observe the plug-in logs.
reset: false
Do NOT use reset: false.
The first time I install the app, I will call reset = true. Will I call reset = true again when I re-enter the app or will I call reset = false? @christocracy
Just delete that option from your Config and forget you ever saw it. You don’t need to think about it.