android - onPause(), different results from home and back button -


i'm creating application uses locationmanager() handle updates gps. when app closed, want updates locationmanager stop , has piece of code @ moment.

@override protected void onpause() {     super.onpause();     if(locationmanager != null){         locationmanager.removeupdates(locationlistener); } 

when exit app button, onpause() called , gps stop. nothing weird here. but, if press home button, gps marker in status bar remains visible, though onpause called same.

that because when exit app button activity destroyed (receives ondestroy callback). , there no process uses gps marker hidden. if lock device screen or press home button application still run activity stopped. code won't gps updates after onpause until register them again.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -