Plugin is connected to app wich is generated by Outsystems Platform.
On other devices like samsung, realme is working well,
but xiaomi is not sending locations when app goes to background, battery optimizations is ignored in settings.
Posting locations from device when in background
Device manufacturer / model: Xiaomi / 220233L2G
Actual Behavior
Application sends only one location and when the application is minimized to the background ,
no data is sent to server
Your Environment
cordova -v
): 9.0cordova platform ls
):9.0Plugin config provided to
#ready
: let configs ={ // Общие настройки debug: true, logLevel: 4, logMaxDays:5, reset: true, desiredAccuracy: -1, distanceFilter: 20, disableElasticity: false, elasticityMultiplier: 2, useSignificantChangesOnly:false, stopOnTerminate: false, startOnBoot: false,locationAuthorizationRequest: "Always", disableLocationAuthorizationAlert: false, heartbeatInterval: 60, // ios настройки stationaryRadius: 5, locationAuthorizationAlert: { titleWhenNotEnabled: "Нет доступа к геолокации", titleWhenOff: "Геолокация отключена", instructions:
Разрешите доступ к геолокации в режме "Всегда"
, cancelButton: "Отмена", settingsButton: "Настройки" }, showsBackgroundLocationIndicator:true, preventSuspend: true,// android настройки fastestLocationUpdateInterval: 60000, allowIdenticalLocations: true, backgroundPermissionRationale: { title: "Доступ к геолокации", message:
Разрешите доступ к геолокации для приложения, в "любом" режиме
, positiveAction: "Разрешить", }, foregroundService: true, enableHeadless: true, notification:{ title: "", text: "Работает в фоновом режиме" },// настройки передачи геолокации
url:$parameters.url, method: "POST", httpTimeout: 30000, autoSync: true,
batchSync: true,
maxBatchSize: 10, maxDaysToPersist: 3, maxRecordsToPersist: 10000,
extras:{ "userId":$parameters.userId }, params:{ "userId":$parameters.userId, "manufacturer":$parameters.manufacturer, "model":$parameters.model, "platform":$parameters.platform, "version":$parameters.version }, schedule: [
1-7 ${$parameters.startTime}-${$parameters.endTime}
], scheduleUseAlarmManager: true }window.BackgroundGeolocation.ready(configs) .then(()=>{ scheduleStart(); forceStart(); }) .catch((error)=>{ $actions.LogMessage("Error ready config:"+error,1) })
function scheduleStart(){ window.BackgroundGeolocation.startSchedule() .then((state) => { $actions.LogMessage("Schedule Started:"+$parameters.UserName+",State:"+state.enabled,1) }) .catch((error)=>{ $actions.LogMessage("Schedule start error:"+$parameters.UserName+",Error:"+error,1) }) }
function forceStart(){ window.BackgroundGeolocation.getState() .then((state)=>{ if(!state.enabled){ window.BackgroundGeolocation.start() .then((state) => { $actions.LogMessage("Background Geolocation Start:"+$parameters.UserName+",State:"+state.enabled,1) }) .catch((error)=>{ $actions.LogMessage("Background Geolocation Start Error:"+$parameters.UserName+",Error:"+error,1) }) }else{ $actions.LogMessage("Tracking already started:"+$parameters.UserName+",State:"+state.enabled,1) } }) }
Expected Behavior
Plugin is connected to app wich is generated by Outsystems Platform. On other devices like samsung, realme is working well, but xiaomi is not sending locations when app goes to background, battery optimizations is ignored in settings.
Posting locations from device when in background
Actual Behavior
Application sends only one location and when the application is minimized to the background , no data is sent to server
Context
Debug logs
background-geolocation-xiaomi.log