What's your use-case for doing this? This would end up draining the battery pretty quickly.
The app needs to track the user's location constantly, even in the background. I know it will drain a lot of battery, but it has to be like this.
For background geolocation, I use the plugin:
But the app needs to get some server information, and for this I use a setInterval to make an ajax request.
For running code in the background, I use the plugin:
The problem is that the app quits when the lock screen appears ... and I could not even find a solution.
Maybe memory leak? Still, there will be a way around this?
I am very grateful for the help.
Is this an enterprise app, or is it destined for the Play store?
Also -- why does it have to be this way? I'm assuming a client requirement here, but this in no way guarantees the user's location -- just the location of the device. And if this is going to the play store, that's incredibly anti-user & anti-privacy.
As for quitting when the device is locked... I don't know. Check the device console (adb logcat) and see if there's any error messages being generated at around the same time.
Thanks for your help!
The app is for the app store, it's a geolocation based game. The location of the device is enough.
Yes, knowing the constant location will not be ideal, but the game idea is to know where the other players are. And players will be alerted about it.
About the app exit in the background, I think that is the smartphone memory.
But I will check and give feedback here.
Again, I appreciate the help.