flutter_background_geolocation
flutter_background_geolocation copied to clipboard
While listening with the application closed, the battery level is being sent as a negative value.
Your Environment
- Plugin version: 4.15.5
- Platform: iOS
- OS version: 17.5.1
- Device manufacturer / model: Iphone 15 (Real Device)
- Flutter info (
flutter doctor
): [✓] Flutter (Channel stable, 3.22.0, on macOS 14.2 23C64 darwin-arm64, locale en-TR) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] VS Code (version 1.91.1) [✓] Connected device (3 available) [✓] Network resources - Plugin config:
String phoneNumber =
prefs.getString('SharedPreferenceEnum.userPhone') ?? '';
String hashCode = prefs.getString('SharedPreferenceEnum.userToken') ?? '';
var ringerValue = await Codes.getRingerMode();
prefs.setInt('SharedPreferenceEnum.ringerMode', ringerValue);
return bg.Config(
desiredAccuracy: bg.Config
.DESIRED_ACCURACY_HIGH, //Doğruluk oranını düzenlemektedir. Ne kadar yüksek doğruluk o kadar yüksek sarj tüketimi demektir.
distanceFilter:
100, // Ne kadar uzaklıkta konum kayıtının yapılacağını bildirir.
stopOnTerminate:
false, // Uygulama kapatıldığında izlemenin devam edebilmesi için false olarak ayarlandı.
startOnBoot:
true, // Cihaz yeniden başlatıldığın da takibin devam edip etmeyeceğini ayarlar true olarak ayarlandı.
debug: false,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
isMoving: false,
autoSync: true,
url: 'http://...................../add-location',
params: {
'telefon': phoneNumber,
'hash': hashCode,
'sesdurum': ringerValue,
},
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: bg.PermissionRationale(
title: "arka_plan_izin_title".tr(),
message: 'arka_plan_izin_text'.tr(),
positiveAction: 'arka_plan_izin_change_button'.tr(),
negativeAction: 'reject'.tr(),
),
);
Expected Behavior
I want the battery level to be transmitted correctly regardless of the application's state.
Actual Behavior
While listening with the application closed, the battery level is being sent as a negative value.
Debug logs
Logs
2024-07-21 09:52:49.065 ✅-[BackgroundTaskManager createBackgroundTask] 28
2024-07-21 09:52:49.066 ℹ️-[TSDBLogger db_save] Log committed
2024-07-21 09:52:49.068 ✅-[TSHttpService schedulePost] LOCKED: DB714B5D-80DE-4D61-A7A4-650A9AC1E628
2024-07-21 09:52:49.310
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | in_vehicle/0 | isMoving: 1
╚═══════════════════════════════════════════════════════════
2024-07-21 09:52:49.310 🔵-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 6
2024-07-21 09:52:50.608 🔵-[HttpResponse handleResponse] Response: 200
2024-07-21 09:52:50.617 ✅-[TSHttpService post:]_block_invoke DESTROY: DB714B5D-80DE-4D61-A7A4-650A9AC1E628
2024-07-21 09:52:50.617
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] Success: 1
╚═══════════════════════════════════════════════════════════
2024-07-21 09:52:50.618 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 28 OF (
28
)
2024-07-21 09:53:00.307
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | in_vehicle/0 | isMoving: 1
╚═══════════════════════════════════════════════════════════
2024-07-21 09:53:00.308 🔵-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 7
2024-07-21 09:53:11.305
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | in_vehicle/0 | isMoving: 1
╚═══════════════════════════════════════════════════════════
2024-07-21 09:53:11.305 🔵-[TSLocationManager createMotionTypeChangedHandler]_block_invoke Shake count: 9
2024-07-21 09:53:13.036
📍<+37.87042656,+32.53541367> +/- 4.75m (speed 10.73 mps / course 169.43) @ 21.07.2024 09:53:13 GMT+03:00
2024-07-21 09:53:13.036
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 200.0m | age: 35 ms
╚═══════════════════════════════════════════════════════════
2024-07-21 09:53:13.036 🔵-[TSLocationManager locationManager:didUpdateLocations:] Updated distanceFilter, new: 150.000000, old: 200.000000
2024-07-21 09:53:13.036 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 4.8
2024-07-21 09:53:13.036 ℹ️-[TSConfig persist]
2024-07-21 09:53:13.038 🔵-[TSConfig incrementOdometer:] 1458.3
2024-07-21 09:53:13.047 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 5703DA50-FCCB-4606-A1AE-21EBFB46B666
New Log:
2024-08-05 15:29:05.944 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 81FBE7B5-9F03-4D82-B50E-938A99A716AE
2024-08-05 15:29:05.944
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2024-08-05 15:29:05.944 ✅-[BackgroundTaskManager createBackgroundTask] 251
2024-08-05 15:29:05.944 ✅-[BackgroundTaskManager createBackgroundTask] 252
2024-08-05 15:29:05.944
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2024-08-05 15:29:05.944 ⚠️-[TSHttpService flush:] Busy with previous request
2024-08-05 15:29:05.944 ℹ️-[TSLocationManager log:message:] onLocation [Location {uuid: EB226B56-161D-4D5B-8792-7B8D44B3BAAA, odometer: 15463.3, sample: true, extras: {}, age: 31941, timestamp: 2024-08-05T12:28:34.000Z, battery: {level: -1.0, is_charging: false}, coords: {speed_accuracy: 4.68, speed: 0.9, longitude: 32.53898619174233, ellipsoidal_altitude: 1044.44, floor: null, heading_accuracy: 180.0, latitude: 37.87557582970895, accuracy: 10.23, altitude_accuracy: 1.69, altitude: 1008.85, heading: 179.88}, is_moving: false, activity: {type: unknown, confidence: 100}}]
2024-08-05 15:29:05.944 ✅-[BackgroundTaskManager createBackgroundTask] 253
2024-08-05 15:29:05.946 ✅-[TSHttpService schedulePost] LOCKED: 81FBE7B5-9F03-4D82-B50E-938A99A716AE
2024-08-05 15:29:05.948 ℹ️+[LocationAuthorization run:onCancel:] status: 3
2024-08-05 15:29:05.948 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON
2024-08-05 15:29:05.948 ℹ️-[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Configured BackgroundFetch
2024-08-05 15:29:05.949 ✅-[SOMotionDetector startDetection]_block_invoke Enabled M7 MotionActivity updates
2024-08-05 15:29:05.949 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 253 OF (
251,
252,
253
)
My db example record: Battery:-1