Required Reading
Plugin Version
5.1.1
Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
Google Pixel 7a
Device operating-systems(s)
Android 16
React Native / Expo version
React Native 0.79.6, Expo 53.0.25
What happened?
Reopening #891 that was never resolved
Expected Behavior
onProviderChanged should be triggered when switching the location permission from OFF to ON from the settings.
Actual Behavior
onProviderChanged is not triggered when switching the location permission from OFF to ON.
Steps to Reproduce
function debugOnProviderChange() {
BackgroundGeolocation.onProviderChange(provider => {
console.log('onProviderChange', { provider });
});
BackgroundGeolocation.ready(backgroundGeolocationConfiguration)
.then(state => {
if (!state.enabled) {
BackgroundGeolocation.start(() => {
console.log('started successfully');
});
}
})
.catch(error => {
console.error({ error });
});
}
- run the above function
- do not grant the permission when prompted
- go to settings
- turn location permission ON
- notice that onProviderChange did not get called.
Context
I'm trying to get an accurate representation of the permission state
Plugin Code and/or Config
javascript
const backgroundGeolocationConfiguration = {
// Common
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 200,
// IOS
stationaryRadius: 50,
disableMotionActivityUpdates: false,
activityType: 'AutomotiveNavigation',
preventSuspend: true,
// Android
locationUpdateInterval: 1 * 60 * 1000, // in ms ~ 1 mins
foregroundService: true,
// Common Activity Recognition
activityRecognitionInterval: 10000,
stopTimeout: 2, // 2 minutes
minimumActivityRecognitionConfidence: 80, // 0-100%. Minimum activity-confidence for a state-change
stopDetectionDelay: 1, // <-- minutes to delay after motion stops before engaging stop-detection system
// Common Application Config
debug: false,
stopOnTerminate: true,
startOnBoot: false,
heartbeatInterval: 60
};
Relevant log output
Required Reading
Plugin Version
5.1.1
Mobile operating-system(s)
Device Manufacturer(s) and Model(s)
Google Pixel 7a
Device operating-systems(s)
Android 16
React Native / Expo version
React Native 0.79.6, Expo 53.0.25
What happened?
Reopening #891 that was never resolved
Expected Behavior
onProviderChanged should be triggered when switching the location permission from OFF to ON from the settings.
Actual Behavior
onProviderChanged is not triggered when switching the location permission from OFF to ON.
Steps to Reproduce
Context
I'm trying to get an accurate representation of the permission state
Plugin Code and/or Config
Relevant log output