Why is OnStop called when the screen turns off

397 views Asked by At

I have an android app which is pretty old now. It's built via the android SDK via ant.

The app starts with a screen and connects to a bluetooth device. The apps does a wake lock to keep CPU and the user presses power to turn screen off.

The app calls onPause() here, not onStop()... everything works fine and the user uses the app with screen off.

However, I am moving this to Android studio. I have the same source, same resource files, same SDK and both are compiled to android 19. But when I press the power button on the version built via android studio onStop() is called and here is does all kind of stuff i don't want, like disconnect BT device??

Why is the android studio compiled version calling onStop() on power button, but the Ant built version of the same source only calls onPause()?

0

There are 0 answers