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?
android android-windowmanager
Nick
source share