Android OS Forum banner
1 - 3 of 3 Posts

·
Android Apprentice
Joined
·
24 Posts
Discussion Starter · #1 ·
Hi guys!

Im developing an app which will locate the users position. GPS being slow I would like to start listening to the GPS listener in Activity A (once the app launches), but I will use the coords in Activity B.

Is there like a way to create a "global" listener so I can access it anywhere from the app? If thats not possible, is better off an AsyncTask or a service?

Thanks in advance!
 

·
Android Beginner
Joined
·
6 Posts
A listener in one activity would not survive the life cycle and therefore I'd recommend unregistering the listener in OnPause. Due to the fact that there is no background activity I'd recommend a service as it is the construct for headless long running tasks.
 

·
Android Apprentice
Joined
·
24 Posts
Discussion Starter · #3 ·
chamonix said:
A listener in one activity would not survive the life cycle and therefore I'd recommend unregistering the listener in OnPause. Due to the fact that there is no background activity I'd recommend a service as it is the construct for headless long running tasks.
Thanks a lot for your comment! (and sorry for the long delay I thought i was auto subscribed to threads I created!) I will look into services now. :D
 
1 - 3 of 3 Posts
Top