I have an alarm scheduled. Using WakeLock.acquire()
and KeyguardLock.disableKeyguard()
, I am able to wake the screen up and show my activity. However, I'd prefer to just show a dialog. The built in alarm on my HTC and Samsung devices act this way. I expected to find a method on the KeyguardLock object, but I didn't see anything in the docs that led me in this direction. How can I keep the KeyguardLock on, but show my dialog on it the way the built-in alarms do. Here is my current code that runs in onCreate()
KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
keyguardLock = km.newKeyguardLock(KeyguardLockTag);
keyguardLock.disableKeyguard();
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
int flags = PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP;
wakeLock = pm.newWakeLock(flags, WakeLockTag);
wakeLock.acquire();