react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Android app crashes on splash after some time is background and open the app again

Open johnandrescv opened this issue 2 years ago • 2 comments

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

  1. stopOnTerminate must be "true"
  2. Terminate app
  3. Open again the app
  4. The app will crash

Context

Right now I set stopOnTerminate "false" but I want to have background location

MicrosoftTeams-image

johnandrescv avatar Jul 27 '23 16:07 johnandrescv

Post the stacktrace from $ adb logcat. There is always a stacktrace.

christocracy avatar Jul 27 '23 20:07 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 06 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 20 '24 01:05 github-actions[bot]