When using the tracker example, is it possible to keep the GPS-locations changing when the user puts the device to sleep (using powerbutton to turn off screen).
Just tested it but when using the powerbutton the debugger shows:
B4X:
** Activity (main) Pause, UserClosed = false **
after that there is no logging of the GPS-change (I've added a log-line).
We're using it in a drivers app but also when the screen goes dark it should keep track and sending data.
Tested on a Xiaomi Mi9 pro then this doesn't occur (android 10)
Tested on a CAT then this doesn't occur (android 4)
Tested on a Samsung Galaxy A9 then this does occur (android 9)
The service acquires a partial lock. It should keep running in the background. You can add a timer to check it.
It is possible that the device turns off the GPS, though it will break other navigation apps as well.
Simple example of a foreground service that keeps the process running in the background. The current location is shown in the persistent notification. The app starts at boot and theoretically should run all the time. It also schedules itself to run with StartServiceAt. This can help in cases...
www.b4x.com
The timer keeps coming back in de logging but the GPS_LocationChanged isn't being triggered any more after using the power button to set the screen dark. This is on a Samsung Galaxy A8. What I also noticed is that, when the screen is dark the GPS_LocationChanged isn't triggered. But when pressing the powerbutton, and you can see the lock-screen, then it is getting triggered.
The same application on a Xiaomi Mi9 works like a charm.
Two things that might help a bit:
1. Whitelist your app in the device settings. On some devices there are such options.
2. Turn the screen on with PhoneWakeState every X seconds and keep it on.