I am trying to give user an alert dialog when alarm notification of calendar is clicked by the user,How to bring alert dialog when user clicks on notification? My question is where to give alert dialog? Either in Alarmservice? or the Class extending AlarmReceiver tha开发者_如何学运维t extends BroadCastReceiver?
The best thing would be to call a new activity from your BroadcastReceiver. There you can do whatever you want.
EDIT: This is what I mean:
Intent intent = new Intent(context, SomeActivity.class);
context.startActivity(intent);
Now that you're calling a new activity - use it as usual... Add your AlertDialog and show it to the user
Just create an activity and when you register it in your manifest add this tag. Have your broadcast receiver onReceiver() method launch it.
<activity android:theme="@android:style/Theme.Dialog">
Also add
excludeFromRecents=true or else
so this way it wont show up in recent.
精彩评论