react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Schedule time doesn't stop send GPS location to server when app is in kill state
Your Environment
Plugin version: 4.9.3 Platform: iOS or Android OS version: Mac os Device manufacturer / model: React Native version (react-native -v): 0.66.3 Plugin config
/// 2. ready the plugin.
BackgroundGeolocation.ready({
// Geolocation Config
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter:
radStatusId == 1
? normalGPSConfig != undefined &&
normalGPSConfig.hasOwnProperty('minmeters')
? normalGPSConfig.minmeters
: 50
: liveGPSConfig != undefined &&
liveGPSConfig.hasOwnProperty('minmeters')
? liveGPSConfig.minmeters
: 20,
// Activity Recognition
stopTimeout: 5,
// Permissions
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: {
title:
"Allow {applicationName} to access this device's location even when closed or not in use.",
message:
'This app collects location data to enable recording your trips to work and calculate distance-travelled.',
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel',
},
disableMotionActivityUpdates: false,
disableElasticity: true,
notification: {
smallIcon: "drawable/ic_stat_onesignal_default"
},
sticky: true,
// Application config
debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
startOnBoot: true,
enableHeadless: true, // <-- Auto start tracking when device is powered-up.
url: COORD2,
autoSync: true,
batchSync: true,
maxBatchSize: 5,
headers: {
Accept: 'application/json',
},
params: {
apikey: API_KEY,
appvers: user.version,
client: clientID,
bookingID: bookingID,
mo: 1,
tz: new Date().getTimezoneOffset(),
},
schedule:["2022-12-22-08:00 2023-01-21-09:45"],
schedulerEnabled: true,
scheduleUseAlarmManager: true,
showsBackgroundLocationIndicator: true,
extras: {
mo: 1,
},
locationsOrderDirection: 'DESC',
maxDaysToPersist: 14,
})
.then(state => {
setEnabled(true);
BackgroundGeolocation.startSchedule();
console.log(
'- BackgroundGeolocation is configured and ready: ',
state,
);
})
.catch(error => {
console.warn('- BackgroundGeolocation error: ', error);
});
Expected Behavior
App should stop sending co-ordinates as soon as schedule time out even when app is in kill state.
Actual Behavior
When App is in kill state it keeps sending gps co-ordinate to the server event after the time has passed it only stop when app is reopened.
Steps to Reproduce
Context
We have a tracking mechanism which should start & stop base on the date-time passed via api. So we have passed the datetime in the required format, Now the tracking gets as per the passed time in schedule but if the app is in kill state then tracking dose not get stop when the stop time get passed and it continue to send the GPS location to server unit app is opened.
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
See wiki Debugging.
Provide evidence from plugin logs when this occurs.
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.