1

How do i prevent my app from closing when the device goes to sleep mode, i obsevered that anytime my device goes to sleep mode my app closes but i want it still open when the device goes to sleep mode

  • Apps don't close when the device goes to sleep. Do you mean you have background threads and such you want to keep processing? Or are you crashing when it goes to sleep? Something else? Needs more detail for us to help you. – Gabe Sechan Feb 04 '15 at 19:54
  • @GabeSechan, based on what i obseved it doesnt crash, it just closes when the device is in sleep mode –  Feb 04 '15 at 19:56
  • possible duplicate of [How to prevent app from closing when android device goes to sleep](http://stackoverflow.com/questions/28811831/how-to-prevent-app-from-closing-when-android-device-goes-to-sleep) – grattmandu03 Mar 02 '15 at 14:44

1 Answers1

0

http://developer.android.com/training/basics/activity-lifecycle/index.html

Check out the OnPause() func!

@Override
public void onPause() {
super.onPause();  // Always call the superclass method first

// Release the Camera because we don't need it when paused
// and other activities might need to use it.
if (mCamera != null) {
    mCamera.release()
    mCamera = null;
}

}

Best of luck fellow dev!

cyclical
  • 395
  • 4
  • 14