I've created an Ionic App with Capacitor that's supposed to send the GPS coordinates to an API every minute. That works generally, but when it comes to working when the screen is locked it gets troublesome.
Now, I've included cordova-background-mode, as well as ForegroundService. Yet, it still stops after 5 minutes. I've also used
this.backgroundMode.disableWebViewOptimizations();
this.backgroundMode.disableBatteryOptimizations();
but to no avail.
I even manually deactivated Battery Optimisation in the settings.
What am I overlooking?
That plugin is broken. I had many failed attempts to make it work but failed.
The only solution I found was to use this one instead. It works even if the screen is locked for hours.