Onmylocationchangelistener Google maps android

Asked

Viewed 79 times

1

I have an application that works as a GPS tracking, is working normal, when the user moves he plays on my server the change that makes all the devices change places the Marker. However I need to make the function Onmylocationchangelistener, work even with the application closed, I thought in a Service, but I do not know if this is possible. Does anyone know if it is? If it is not, there is a better way to do it?

  • 1

    Yes, it is possible. In the same way it connects with GoogleApiClient in Activity, it is possible to do in a Service, but will use the LocationClient and not the GoogleMap. Just watch out for the use of GPS, don’t let the Service active without need, because GPS uses a lot of battery. To use the LocationClient have a look at http://developer.android.com/training/location/receive-location-updates.html.

  • Oops, thanks, I’ll try to use.

1 answer

1

Yes this is possible. You must declare an Intentservice and use a Broadcast to communicate with the app. You can always keep your location data up to date, even if the app isn’t running. Here you find the best way to do this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.