2

I am trying to mimic the pop-up notification of WhatsApp. (If you have not seen it, it might be a bit hard for you to understand this.) Below is an image to give a clearer perspective.

whatsapp pop up notificaiton

Some suggested that this might be done using an oridnary activity which has the Theme.Holo.Light.Dialog.Alert theme. However, when I implemented that I got half of the activity full with the views (and the other half) which is supposed to be empty like a dialog, showing a white background. ie, I did not have the dialog feel.

Morever, when the device is in standby mode (power button pressed) and locked, whatsapp is able to bypass that and show the popup dialog (or activity, or whatever) above that.

Any ideas how to implement this ?

tony9099
  • 4,567
  • 9
  • 44
  • 73
  • 1
    A custom styled dialog (http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout) and permission to by-pass the lock ? – Entreco Jan 15 '14 at 15:10
  • @Entreco Well, I have a question. How can i showing this from `onMessageReceived` (Note- App is background mode). – IntelliJ Amiya Jun 26 '19 at 13:54
  • 1
    @IntelliJAmiya Have a look here: https://stackoverflow.com/questions/7918571/how-to-display-a-dialog-from-a-service – Entreco Jun 27 '19 at 05:50

1 Answers1

1

Oh god! After hours, I found the solution!

Refer link:http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout

It's extremely easy, you just need to set up the theme of the activity to @android:style/Theme.Holo.Dialog in manifest like:

<activity android:theme="@android:style/Theme.Holo.Dialog" >