0

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()?

user1667016
  • 123
  • 2
  • 8
  • I don't know, but regardless of what you want to happen, the result you get with AS is correct. If the activity is no longer visible, onStop is called – Tim Nov 06 '18 at 14:46
  • have you tried apk generated from both sources on same device? If you are on new version of android, it can be due to OS restrictions on background task. On old version of android the OS was not as restrict as it is now. – Umar Hussain Nov 06 '18 at 14:58
  • The code source and res are the same and deployed to the same device, i remove app built via ant (have used for years prob free) and then reply the AS one. one calls onPause on power and has for years on a dozen different devices. Same app built on AS deployed to the very same device onStop() – user1667016 Nov 06 '18 at 15:31
  • things change, platforms evolve. What was the case in 2011 might be different now – Tim Nov 06 '18 at 15:41

0 Answers0