GPS will not stop even thouth I have installed OnPause code to stop the GPS service. Here is my code.
@Override
protected void onPause() {
if(lm != null) {
lm.removeUpdates(ll);
}
ll = null;
lm = null;
super.onPause();
}
This code runs without errors as long as lm and ll are declared as protected variables globally. The problem is that the GPS icon stays on after I leave the program. How do I turn GPS off? I have tested this on a phone and the emulator.
My problem was that the location manager and location listener names were being redefined in the on change location code so that they were not the global ones referenced in the global statements. I copied this code from a YouTube tutorial and I would assume many others have this same problem. Once I deleted the re-definition not the GPS goes off almost instantly when the screen is back arrowed out. In fact, the GPS goes off so quickly, this is now a problem I need to deal with.
See lm.removeUpdate(ll); not releasing updates