I'm building an application for recording the user's route. I have a foreground service
where I request the current location every 10 seconds. Because of the fact that LocalBroadcastManager
is deprecated, I use Greenrobot's EventBus
for sending the coordinates to the activity, where I update a MapView with them.
Because of battery efficiency, I would like to turn the screen off while the user records his route and after the user is ready, when he turns the screen on to sees his actual route on the MapView will terminate the service with a button.
How can I achieve this functionality?
I've searched for a lot of solutions and I found Wave Lock
, but it's used for keeping the screen on, the opposite of that what I want.