android - Do I need to stop GPS usage once MapView activity is closed? -


currently display user's location @ mapview:

mylocationoverlay mylocationoverlay = new mylocationoverlay(this, mapview);      mapview.getoverlays().add(mylocationoverlay);       mylocationoverlay.enablemylocation();  

but once user closes mapview activity (press button) or closes mainactivity (presses again), gps icon still displayed in status bar. looks gps still used. should in code avoid that?

yes need stop gps usage avoid battery draining, following methods stop gps usage used in relevant methods onpause, onstop, ondestroy:

mylocationoverlay.disablemylocation(); locationmanager.removeupdates(locationlistener); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -