I want to keep listening for location update even when my app destroyed (or closed), do i have to run a service for this? and what is the best practice’s for continuous location update other than the ones described here.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your application is destroyed by the OS then it won’t do anything. Activities and Services can both be killed by the OS if needed. Furthermore, unless you request a WAKE_LOCK you won’t get updates if the phone enters sleep either.
Having said that, yes, you want to create a
Servicethat implementslocationListenerand respond appropriately toonLocationChanged(). That way, the app will still receive the updates in the background.