Open ihebConverto opened 4 years ago
The application stopped programming due to this problem .. any ideas to solve it ...
It may be that the app needs authorization for background data. See: https://www.samsung.com/hk_en/support/mobile-devices/how-do-i-restrict-background-data/ You must enable "Allow aap while Data saver on" too.
I have the same problem, the app has authorization to work in the background and the battery optimization is disabled, even so it stops saving locations or updating them by url. Any suggestion? I am using Ionic 5
I've also installed these CORDOVA plugins and I've better result: cordova-plugin-powermanagement-orig and cordova-plugin-backgroud-mode .
IONIC : @ionic-native/background-mode => ...enable(); ...disableWebViewOptimizations();
and @ionic-native/power-management => ...powerManagement.dim(); ...powerManagement.setReleaseOnPause(false);
I'm currently debugging this. It seems for me that in android 9 background location is still working. In the simulator for android 10 & 11 I can only give location permissions to "while app is running" and not in the background all the time. Am I missing something?
@tobika This is probably the threads you're looking for: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/688 https://github.com/mauron85/cordova-plugin-background-geolocation/issues/691
@tlacroix thanks a lot, sorry I didn't write before but I also found this posts and it works well now :+1:
not sure if this is related: If I use url: 'server.tld:port' I keep receiving data (the object is inside an array though) What basically stops working in background is the callback
this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {
Your Environment
Plugin configuration options:
const bgGeolocationConfig: BackgroundGeolocationConfig = { desiredAccuracy: 10, stationaryRadius: 20, distanceFilter: 5, interval: 5000, debug: false, // enable this hear sounds for background-geolocation life-cycle. stopOnTerminate: false, // enable this to clear background location settings when the app terminates stopOnStillActivity: false, startOnBoot: true, maxLocations: 500, url:
${this.appConfig.apiUrl}/locate
, httpHeaders: { 'Accept': 'application/json', 'Authorization':Bearer ${this.currentToken}
, 'Content-Type': 'application/json' }, // customize post properties postTemplate: { latitude: '@latitude', longitude: '@longitude', } };Context
It work perfectly in the foreground but in the background when we close the App the server is not receiving any request from the plugin