1

当设备进入睡眠模式时,如何防止我的应用程序关闭,我观察到,只要我的设备进入睡眠模式,我的应用程序就会关闭,但我希望它在设备进入睡眠模式时仍然打开

4

1 回答 1

0

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

查看 OnPause() 函数!

@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;
}

}

祝各位开发者好运!

于 2015-02-04T19:53:51.543 回答