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
Post a Comment