react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Android app crashes on splash after some time is background and open the app again
Your Environment
- Plugin version:^4.12.1
- Platform: Android
- OS version: 12 & 13
- Device manufacturer / model: Google
- React Native version (
react-native -v): 0.70.4 - Plugin config
BackgroundGeolocation.ready({
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_MEDIUM,
distanceFilter: 10,
preventSuspend: true,
stopOnTerminate: false,
startOnBoot: true,
foregroundService: true,
url: "https://app.alz-well.com/api/v1/user/location",
headers: {"Authorization": `Bearer ${this.props.settings.tokenBackup}`},
autoSync: true,
batchSync: true,
locationsOrderDirection: 'DESC'
}).then(state => {
BackgroundGeolocation.getCurrentPosition({ timeout: 30, maximumAge: 5000, desiredAccuracy: 10}).then((({coords}) => {
let settings = {...this.props.settings};
settings.myLocation = {latitude: coords.latitude, longitude: coords.longitude, latitudeDelta: 0.01, longitudeDelta: 0.01};
this.props.updateSettings(settings);
}));
BackgroundGeolocation.start();
}).catch(error => {
console.warn('- BackgroundGeolocation error: ', error);
});
Expected Behavior
When app goes from background to foreground works properly
Actual Behavior
App crashes on splash after some time is background
Steps to Reproduce
- stopOnTerminate must be "true"
- Terminate app
- Open again the app
- The app will crash
Context
Right now I set stopOnTerminate "false" but I want to have background location
Post the stacktrace from $ adb logcat. There is always a stacktrace.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.