Work in stand-by


Active Member
Licensed User
Longtime User
In my app I have a service that refreshes text of labels when gps coordinates change...How can I do to refresh data also when the screen goes to standby?
So that when I activate the screen I can see updated text..


B4X founder
Staff member
Licensed User
Longtime User
The GPS will be turned off when the device sleeps. This will happen sometime after the screen turns off. You can take a PartialWakeLock with PhoneWakeState however it will have a bad effect on the battery.

You can also use StartServiceAt to wake the device every x minutes, wait for a GPS fix and store the coordinates. You can call CallSubDelayed to send the coordinates to the activity. Once the activity resumes it will handle the call sub message.
Upvote 0