transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.63k stars 426 forks source link

activityType getting wrong when app is in background or killed state #2146

Closed Bhavin-hyperspace closed 20 hours ago

Bhavin-hyperspace commented 21 hours ago

Plugin version: 4.17.1 Platform: Android OS version: 14 Device manufacturer / model: Motorola edge 40 neo React Native version (react-native -v): 0.74.2 Plugin config BackgroundGeolocation.ready( { reset: true, desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: 30, // Distance in meters stopOnTerminate: false, // Persist location tracking in the background startOnBoot: true, // Start location tracking on device boot logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, enableHeadless: true, locationAuthorizationRequest: 'Always', backgroundPermissionRationale: { title: 'Background Location Permission required', message: 'App need to use your background location to track the miles precisely. Please select "Allow all the time" in location permission', }, activityType: 'AutomotiveNavigation', locationAuthorizationAlert: { titleWhenNotEnabled: 'Background Location Permission disabled', titleWhenOff: 'Background Location Permission required', instructions: 'My app need to use your background location to track the miles precisely. Please select "Allow all the time" in location permission', settingsButton: 'Settings', cancelButton: 'Cancel', }, },

Expected Behavior

When the app is in the background and I start driving, the activityType should change from still to in_vehicle.

Actual Behavior

I am always getting activityType as still, even though I am in a vehicle when the app is in background or killed mode.

Context

I want to log the location only when my activityType is in_vehicle.

christocracy commented 20 hours ago

The plug-in has no control over the results that come out of the Motion api. It’s a black box that presumably fuses data from the accelerometer and gyroscope into a machine-learning model. The results are heavily dependant upon the quality of sensors on your device.

there’s nothing the plug-in can do to improve the results.