BroadcastReceiver onReceive Dialog Box

I am creating an Android application with BroadcastReceiver and I want to show a dialog when starting onReceive . I want to show a dialogue on the phone (show the user a dialogue no matter where he is, for example, whatsapp when receiving a message).

How can i do this?

Thanks!

+4
source share
1 answer

If you want to display a dialog inside your onReceive BroadcastReceiver, inside your broadcast receiver you can start transparent work with a warning dialog box and NEVER call setContentView() . The activity will be transparent and only a warning dialog will be displayed. Source: Displays a warning dialog box in the broadcast receiver after a system reboot.

There are many similar posts that talk about this topic. Below are questions for code samples and other reviews:

  1. AlertDialog from within BroadcastReceiver ?? It can be done?

  2. How to raise the alert dialog from the BroadcastReceiver class?

  3. How to display a dialog from an Android broadcast receiver?

  4. How to configure Alertbox from BroadcastReceiver

Hope this helps.

+4
source

Source: https://habr.com/ru/post/1493893/


All Articles