@Override public void onPause() { if (mKeyguardLock != null) { mKeyguardLock.reenableKeyguard(); } mWakeLock.releaseWakeLock(); super.onPause(); }
@Override public void onResume() { super.onResume(); KeyguardManager mKeyGuardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE); mKeyguardLock = mKeyGuardManager.newKeyguardLock("screenunlock"); mKeyguardLock.disableKeyguard(); mWakeLock = new WakeLockManager(getBaseContext()); mWakeLock.setWakeLock(true, true); }