-
Notifications
You must be signed in to change notification settings - Fork 440
Description
Required Reading
- Confirmed
Plugin Version
4.17.5
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
iphone 13 pro max and samsung galaxy is Android version 15
Device operating-systems(s)
18.6.2 for ios and
React Native / Expo version
0.70.6
What happened?
When we set the distance filter to 1 we are doing show so that our app can show speed accurately when moving at slower speeds. when we used distance based filter it shows user going at say 30 mph even when stopped. So we put distance filter to 1 to test battery drain and even when phone is not moving for 8 hours when sleeping the battery is being drained as location updates keep coming. Here are our plugin settings:
BackgroundGeolocation.ready({
debug: false,
locationAuthorizationRequest: 'Always',
showsBackgroundLocationIndicator: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_ERROR,
activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER,
desiredAccuracy: desiredAccuracy ?? BackgroundGeolocation.DESIRED_ACCURACY_VERY_LOW,
startOnBoot: true,
enableHeadless: true,
stopOnTerminate: false,
stopOnStationary: false,
disableElasticity: false,
allowIdenticalLocations: false,
distanceFilter: distanceFilter ?? 1,
pausesLocationUpdatesAutomatically: true,
locationAuthorizationAlert: {
titleWhenOff: t('title_when_off'),
cancelButton: t('location_auth_alert_cancel'),
titleWhenNotEnabled: t('title_when_not_enabled'),
settingsButton: t('location_auth_alert_settings'),
instructions: t('location_auth_alert_instructions'),
},
stopTimeout: 3,
backgroundPermissionRationale: {
message: message,
negativeAction: t('Cancel'),
positiveAction: Change to ${permissionOption},
title: t('allow_serendipity_to_use_your_location'),
},
});
Please tell me how we can fix this so that locations do not come when the phone is not moving?
Plugin Code and/or Config
BackgroundGeolocation.ready({
debug: false,
locationAuthorizationRequest: 'Always',
showsBackgroundLocationIndicator: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_ERROR,
activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER,
desiredAccuracy: desiredAccuracy ?? BackgroundGeolocation.DESIRED_ACCURACY_VERY_LOW,
startOnBoot: true,
enableHeadless: true,
stopOnTerminate: false,
stopOnStationary: false,
disableElasticity: false,
allowIdenticalLocations: false,
distanceFilter: distanceFilter ?? 1,
pausesLocationUpdatesAutomatically: true,
locationAuthorizationAlert: {
titleWhenOff: t('title_when_off'),
cancelButton: t('location_auth_alert_cancel'),
titleWhenNotEnabled: t('title_when_not_enabled'),
settingsButton: t('location_auth_alert_settings'),
instructions: t('location_auth_alert_instructions'),
},
stopTimeout: 3,
backgroundPermissionRationale: {
message: message,
negativeAction: t('Cancel'),
positiveAction: `Change to ${permissionOption}`,
title: t('allow_serendipity_to_use_your_location'),
},
});