Closed Skvitthani closed 2 months ago
Also, when testing, go outside for a walk with a real device for at least 1km.
see wiki “Philosophy of Operation” and “Debugging”.
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.
Plugin version: 2.11.0 Platform: iOS OS version: 14.4 Device manufacturer / model: Apple iPhone 12 React Native version: 0.72.7 Plugin config BackgroundGeolocation.ready({ desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: 25, stopTimeout: 10, debug: false, logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, stopOnTerminate: false, startOnBoot: true, url: "http://yourserver.com/locations", batchSync: false, autoSync: true, disableMotionActivityUpdates : true, headers: { "X-FOO": "bar" }, }, (state) => { if (!state.enabled) { BackgroundGeolocation.start(function() { console.log("- Start success"); }); } });
export async function startLocationUpdateAsync() { try { await BackgroundService.start(veryIntensiveTask, options); } catch (error) { console.log('ERROR :: startLocationUpdateAsync :: ', error) } }
const veryIntensiveTask = async (taskDataArguments: any) => { await new Promise(async resolve => { try{ if(Platform.OS == 'ios'){ BackgroundGeolocation.ready({ desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: 25, stopTimeout: 10, debug: false, logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, stopOnTerminate: false, startOnBoot: true, url: "http://yourserver.com/locations", batchSync: false, autoSync: true, disableMotionActivityUpdates : true, headers: { "X-FOO": "bar" }, }, (state) => { if (!state.enabled) { BackgroundGeolocation.start(function() { console.log("- Start success"); }); } });
}else{ Geolocation.watchPosition( (location: any)=> { reduxActions.location.updateLocation( location.coords.latitude, location.coords.longitude, ); }, error => {}, { enableHighAccuracy: false, maximumAge: 0, distanceFilter: 30, }, ); } }catch(e){console.log('e',e)} }) };
Expected Behavior
It Should work in the background until the app gets killed in iOS only.
Actual Behavior
It works only for 30 seconds in the background.