you can subscribe to requestLocationUpdates via two ways
- one by specifing a PendingIntent
- the other is by using a LocationListener
When is advised the one and when the other?
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 the component needing location updates only needs updates when the component is around — say, an activity — I’d use the
LocationListenerapproach.If the component needing location updates specifically will not be around — say, an
IntentService— I’d use thePendingIntent. You can’t use theLocationListenerin this case, since there is nothing in memory to be listening for locations.