We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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"); }); } });
BackgroundGeolocation.onLocation(({ coords }) => { try { if (coords) { const { latitude, longitude} = coords; reduxActions.location.updateLocation( latitude, longitude, ); } } catch (error: unknown) { console.log('error',error) } });
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)} }) };
It Should work in the background until the app gets killed in iOS only.
It works only for 30 seconds in the background.
The text was updated successfully, but these errors were encountered:
Please learn to syntax highlight fenced codeblocks
Sorry, something went wrong.
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.
No branches or pull requests
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.
The text was updated successfully, but these errors were encountered: