Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyguard is shown briefly before Activity is launched when using FLAG_SHOW_WHEN_LOCKED

I'm using the following flags in onAttachedToWindow() to show my Activity above the keyguard:

FLAG_DISMISS_KEYGUARD | FLAG_SHOW_WHEN_LOCKED | FLAG_TURN_SCREEN_ON

This works fine, however, when launching my activity from a background service while the screen was off, the keyguard sometimes shows for 1-2 seconds before my app is displayed. This happens particularly on slower phones (or in low memory situations). I find this strange, since my understanding was that onAttachedToWindow() is called after onCreate()/onResume(), so all the "heavy work" should already have been completed when the flags mentioned above are being set? Is there any way to only show my Activity once it has been completely set up?

like image 927
Nick Avatar asked Oct 02 '13 15:10

Nick


1 Answers

Have you tried UI Thread. Try to look at this good tutorial http://androidpartaker.wordpress.com/tag/ui-thread/. Hopre this helps you.

like image 96
RussVirtuoso Avatar answered Oct 20 '22 21:10

RussVirtuoso