i need to dismiss the default lock screen on some cases . it is possible using KeyguardManager.KeyguardLock , but it's deprecated and might not be available on the new android v4 version (ICS) . instead , here android docs i read that i should use "Use FLAG_DISMISS_KEYGUARD and/or FLAG_SHOW_WHEN_LOCKED "

so I've tried playing with them , but no matter what i try , after closing the activity that use those flags , i get back to the default lock screen , even if it's not the secure one . what is going on , and how should i fix it?

I've also read that there are some workarounds , by replacing the launcher application , but this is a weird fix , and requires the user's intervention , even though the application is not really a launcher application , and i'm not sure how i would

such a feature might even be used for replacing the lock screen with your own customized lock screen

有帮助吗?

解决方案

Check our issue 8778, which seems to be similar to what you are facing. The FLAG_DISMISS_KEYGUARD constant will ONLY work if you are using an Activity, it must not be PixelFormat.TRANSLUCENT, and it is forcing itself to be full screen, hiding system decoration like the status bar. The KeyguardManager API is deprecated, but it still works on Android 4.0 ICS and it is arguably your best bet at disabling the lock screen reliably and from any part of your code (even a background Service).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top