Search code examples
androidtimerdialogwakeup

Android: How can I open a dialog which is started while sleep?


In my app I have a service which has a BroadcastReceiver which listens to TIME_TICK. I already could check if a date is reached. So if for excemple the 04.01.2011 11:00 pm is reached there is a vibration alarm. But how could I open a dialog so that after I unlocked my screen it is shown?


Solution

  • Launch an intent for an activity when the time is reached.

    Declare on the manifest a theme for this activity like:

    android:theme="@android:style/Theme.Dialog"
    

    and create a view for the activity just like the inside of a dialog, so you don't need to create an AlertDialog.