Pedro Oliveira
Pedro Oliveira

Reputation: 20500

Android MapView keeps Location on

I have a simple fragment with a mapview displayed. I have override all the necessary methods according to the documentation (destroy, resume and start) to cal the same method of the mapview. However when I detach the fragment or exit the application the location keeps on. It will drain too much battery. Is there any procedure I can make to stop the location feature?. I've tried calling mapview.onDestroy, mapview=null, etc etc and the location keeps on.

Thanks

Upvotes: 0

Views: 315

Answers (1)

0101100101
0101100101

Reputation: 5911

Check How to unregister Listener & stop service from within broadcastreceiver. If you're using LocationManager to get location updates, call removeUpdates(getActivity()) on your LocationManager instance to stop them.

Edit as requested: Searching the current location via GPS is disabled by calling setMyLocationEnabled(false) on the GoogleMap instance.

Upvotes: 1

Related Questions