1

My service receives some notification which might happen while the keyguard is active. Is there some way to show a Toast message in this state? First attempts showed that the Toast is shown "behind" the keyguard (i.e. it is visible if the keyguard is unlocked while the message is still shown), but not on top of the keyguard.

Is there any way I can use a Toast in this scenario or am I required to write my own activity that has the appropriate flags set to be shown on top of keyguards?

Thanks in advance!

P.S.: I am aware the user might miss the Toast, therefore a notification is also added as well, but for my personal taste I'd also like to show the message as part of a Toast (user-configurable) because the toast is in my opinion better suited for longer messages).

Martin C.
  • 12,140
  • 7
  • 40
  • 52
  • By keyguard do you mean the lock screen? I would be really surprised if you could show anything on top of it on a non-rooted phone... – P Varga Jan 10 '12 at 23:01
  • Yes, you can for instance show Activities with some flags, e.g. FLAG_SHOW_WHEN_LOCKED and some others, see http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html But I'd really have preferred not to build a full-screen Activity to show some short information that won't fit the ticker-text of the notification area, though. – Martin C. Jan 11 '12 at 16:24
  • Have you solved it already? I meet the same problem when my Toast is locked by keyguard. However, It just happens when I updated my code into 4.1.2 version (4.1.1 runs ok). It is so weird!!! How can you pull a Toast on top of keyguards? – Nguyen Jan 15 '13 at 02:18
  • @Nguyen no, it seems it is not possible, at least not with stock Android for now. – Martin C. Jan 21 '13 at 12:18

1 Answers1

0

If you are in the activity that is active above the keyguard then its possible. Tried in 4.4.2 and it worked.

Regards,

prashantwosti
  • 980
  • 2
  • 7
  • 17