Device manufacturer / model: iPhone 12 and iPhone 7
Cordova version (cordova -v): 11.0.0
Cordova platform version (cordova platform ls): iOS 6.2.0
Plugin config provided to #ready:
BackgroundGeolocation.setConfig({batchSync: true});
}
else {
BackgroundGeolocation.setConfig({batchSync: false});
}
if (IOLEnableHeadlessOperation) {
BackgroundGeolocation.setConfig({enableHeadless: true, stopOnTerminate: false});
}
else {
BackgroundGeolocation.setConfig({enableHeadless: false, stopOnTerminate: true});
}
if (IOLAllowDisablingHeadless) {
document.getElementById('disableHeadless').style.display='block';
}
else { document.getElementById('disableHeadless').style.display='none';
}
if (IOLSendLocationOnBoot) {
BackgroundGeolocation.setConfig({enableHeadless: true, startOnBoot: true});
}
else {
BackgroundGeolocation.setConfig({enableHeadless: false, startOnBoot: false});
}
function initBgGeo() {
console.log('initBgGeo');
let restPath=IOLRESTPath+'/'+device.uuid;
let autoSync=true;
if (!IOLhaveIdentity) {
restPath='';
autoSync=false;
}
var bgGeo = window.BackgroundGeolocation;
bgGeo.onLocation(function(location) {
onGeoSuccess(location);
});
bgGeo.onMotionChange(function(event) {
console.log('[motionchange] -', event.isMoving, event.location);
});
bgGeo.onHttp(function(response) {
console.log('[http] - ', response.success, response.status, response.responseText);
HTTPBack(response);
});
bgGeo.onProviderChange(function(event) {
console.log('[providerchange] -', event.status, event.enabled, event.gps, event.network);
});
// 2. Execute #ready method:
let enableHeadless=false;
let startOnBoot=false;
let stopOnTerminate=true;
if (IOLEnableHeadlessOperation) {
enableHeadless=true;
startOnBoot=true;
stopOnTerminate=false;
}
bgGeo.ready({
reset: true,
debug: false,
allowIdenticalLocations: true,
logLevel: bgGeo.LOG_LEVEL_ERROR,
desiredAccuracy: bgGeo.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
url: restPath,
maxDaysToPersist: 5,
autoSync: autoSync,
batchSync: true,
maxBatchSize: 100,
enableHeadless: enableHeadless,
notification: {text: "Supporting "+IOLCustomerName+" drivers in the background"},
stopOnTerminate: stopOnTerminate,
startOnBoot: startOnBoot,
backgroundPermissionRationale: {message: "Location data is used to support you on the road and show our clients the locations their consignments are collected or delivered."}
}, function(state) { // <-- Current state provided to #configure callback
// 3. Start tracking
console.log('BackgroundGeolocation is configured and ready to use');
if (!state.enabled) {
bgGeo.start().then(function() {
console.log('- BackgroundGeolocation tracking started');
});
}
});
}
## Expected Behavior
It should record locations when the app is not in foreground, i.e. when the user speaks on the phone
## Actual Behavior
Location is only captured when the App is in the foreground
## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
1.
2.
3.
4.
## Context
<!--- What were you trying to do? -->
## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat
-->
<details>
<summary>Logs</summary>
```<!-- Syntax highlighting: DO NOT REMOVE -->
PASTE_YOUR_LOGS_HERE
Your Environment
cordova -v
): 11.0.0cordova platform ls
): iOS 6.2.0Plugin config provided to
#ready
: