Get Location updates in background without running Service in Android

682 views Asked by At

I want to fetch the current Location of the user in background. I know how it can be done using Service in Android. But I would like to know is there any possibilities to get user Location without running service. Like using BroadcastReceiver or anything? I'm just trying to avoid running Service to fetch Location.

For Example I referred this link. But I couldn't follow how to do like this.

Any help will be appreciated. Correct me in case I'm asking anything wrong.

EDIT: Oh, I think in the above link he is using Service to get the Location. So I think it's not possible to get location in background without running a Service. Still suggestions are welcomed.

1

There are 1 answers

1
Y2K On

You Should Implement a BroadcastReceiver that receives alarm every 2 hours. That alarm is Set by Your Activity.

When the alarm is triggered by your System, Broadcast Receiver receives it, Executes Your Process in BroadCastReceiver.

This is what i can think of.