各アラームには、一意のハッシュ識別子を持つPendingIntentが付随しています。同じ識別子を使用すると、ドキュメントに記載されているように、そのアラームが前者を上書きします:
http : //developer.android.com/reference/android/app/AlarmManager.html#set(int、long、android.app.PendingIntent)
アラームをスケジュールします。注:...同じIntentSenderにすでにアラームがスケジュールされている場合は、最初にキャンセルされます...
保留中のインテントは、パラメーターと識別子によって特徴付けられることに注意してください。
Intent intent = new Intent(mContext, YourTarget.class);
// The hashcode works as an identifier here. By using the same, the alarm will be overwrriten
PendingIntent sender = PendingIntent.getBroadcast(mContext, hashCode, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
mAlarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
} else {
mAlarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
}