The constructor to AlarmManager.AlarmClockInfo
takes a PendingIntent
, described as "an intent that can be used to show or edit details of the alarm clock". Where is this used by the system? I don't see anything in the Android 6.0 UI that would seem to trigger that PendingIntent
.
Asked
Active
Viewed 676 times
4

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
1 Answers
4
The PendingIntent
is returned by getShowIntent()
in AlarmManager.AlarmClockInfo:
public PendingIntent getShowIntent() {
return mShowIntent;
}
and it's used in the onClick()
method of StatusBarHeaderView:
PendingIntent showIntent = mNextAlarm.getShowIntent();
if (showIntent != null && showIntent.isActivity()) {
mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */);
}
Visually, the thing the user clicks on to invoke the PendingIntent
is the date/time of the alarm, shown in the following screenshot in grey to the right of the alarm clock icon:

CommonsWare
- 986,068
- 189
- 2,389
- 2,491

Mattia Maestrini
- 32,270
- 15
- 87
- 94
-
Thanks for pointing out the pending intent should start an activity. Now I see why my `BroadcastReceiver` doesn't receive anything at all. – Nikolai Aug 08 '16 at 10:46
-
Is it mandatory to provide ShowIntent? I can see there is a null check in the code. – Arashsoft May 12 '18 at 15:37