Key protection is displayed briefly before starting Activity when using FLAG_SHOW_WHEN_LOCKED

I use the following flags in onAttachedToWindow() to show my Activity on a key lock:

FLAG_DISMISS_KEYGUARD | FLAG_SHOW_WHEN_LOCKED | FLAG_TURN_SCREEN_ON

This works great, however, when I start my activity from the background service, when the screen was turned off, keyguard is sometimes displayed 1-2 seconds before the display of my application. This occurs, in particular, on slower phones (or in situations with low memory). I find this strange, since I realized that onAttachedToWindow() is called after onCreate() / onResume() , so all the "hard work" should already be completed when the flags mentioned above are set? Is there a way to show my Activity only after it has been fully configured?

+7
android android-windowmanager
source share
2 answers

Have you tried the user interface theme. Try looking at this good tutorial http://androidpartaker.wordpress.com/tag/ui-thread/ . Hopre it will help you.

+1
source share

try to add

android.permission.DISABLE_KEYGUARD resolves your xml manifest

source: link

0
source share

All Articles