Thanks for sharing...
I had the following code.. which works on the emulator, but I can't
get it to work on my phone (with or without the pattern lock enabled):
I had a line in my onPause that calls reenableKeyguard(), if
unlocked==true.
I'll keep trying - I noticed your code uses
PowerManager.ON_AFTER_RELEASE. I'll report back if adding that helps
or if I figure it out myself.
//wake phone
Log.d(TAG, "mWakeLock.acquire/release()");
PowerManager pm = (PowerManager) getSystemService
(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP, "TEST");
mWakeLock.acquire();
mWakeLock.release();
//unlock phone
KeyguardManager km = (KeyguardManager) getSystemService
(Context.KEYGUARD_SERVICE);
mKeyguardLock = km.newKeyguardLock("TEST");
if (km.inKeyguardRestrictedInputMode()){
km.exitKeyguardSecurely(new
KeyguardManager.OnKeyguardExitResult(){
@Override
public void onKeyguardExitResult(boolean
success) {
if (success){
Log.d(TAG,
"onKeyguardExitResult success");
} else {
Log.d(TAG,
"onKeyguardExitResult ! success");
}
}
});
Log.d(TAG, "inKeyguardRestrictedInputMode -
disableKeyguard");
mKeyguardLock.disableKeyguard();
unlocked = true;
}
On Feb 24, 10:22 am, jarkman <[email protected]> wrote:
> As far as I can tell, my PowerManager code works properly when the
> device is on charge, but generally doesn't wake the device up when it
> is not on charge. I shall keep digging. Perhaps I need to hold the
> wakelock for longer to stop it snoozing.
>
> R
>
> On Feb 23, 11:24 pm, SteveV <[email protected]> wrote:
>
> > Does anyone know how to do this correctly?
>
> > I can't find any examples & the API documentation is pretty hard to
> > follow.
>
> > I am guessing I need to use the KeyGuardManager and PowerManager...
> > but can't figure out how to bring my activity up past the keyguard and
> > re-enable the keyguard so my activity doesn't let someone get past the
> > lock when my activity awakens.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---