@@ -164,7 +164,7 @@ public static void setupDebugAlarm(Context context) {
164164 alarmIntent .putExtra (ALARM_TONE , "content://media/internal/audio/media/10" );
165165 alarmIntent .putExtra (ALARM_VIBRATE , true );
166166 PendingIntent alarmPendingIntent = PendingIntent .getBroadcast (
167- context , 42 , alarmIntent , PendingIntent .FLAG_UPDATE_CURRENT );
167+ context , 42 , alarmIntent , PendingIntent .FLAG_CANCEL_CURRENT );
168168
169169 if (Build .VERSION .SDK_INT >= 19 ) {
170170 alarmManager .setExact (AlarmManager .RTC_WAKEUP , alarmDate , alarmPendingIntent );
@@ -196,14 +196,16 @@ public static boolean alarmIsUp(Context context, long id) {
196196 }
197197
198198 public static void cancelAlarm (Context context , long id ) {
199+ // Does only cancel the pending intent, it does not write to the database.
199200 AlarmManager alarmManager = (AlarmManager ) context .getSystemService (Context .ALARM_SERVICE );
200201 Intent alarmIntent = new Intent (NightKillerReceiver .ACTION_FIRE_ALARM );
201202 PendingIntent alarmPendingIntent = PendingIntent .getBroadcast (context ,
202- (int )id , alarmIntent , PendingIntent . FLAG_UPDATE_CURRENT );
203+ (int )id , alarmIntent , 0 );
203204 alarmManager .cancel (alarmPendingIntent );
204205 }
205206
206207 public static void cancelAllAlarms (Context context ) {
208+ // Does only cancel the pending intent, it does not write to the database.
207209 Cursor cursor = AlarmDBOpenHelper .getAlarmDBOpenHelper (context ).query ();
208210 cursor .moveToFirst ();
209211 AlarmDBOpenHelper .Index index = AlarmDBOpenHelper .getIndex (cursor );
@@ -218,7 +220,7 @@ public static void cancelRenewAlarm(Context context) {
218220 Intent alarmIntent = new Intent (ACTION_RENEW_ALARMS );
219221 PendingIntent alarmPendingIntent =
220222 PendingIntent .getBroadcast (context , SpecialPendingIds .RENEW_ALARM ,
221- alarmIntent , PendingIntent .FLAG_UPDATE_CURRENT );
223+ alarmIntent , PendingIntent .FLAG_CANCEL_CURRENT );
222224 alarmManager .cancel (alarmPendingIntent );
223225 }
224226
@@ -229,7 +231,7 @@ public static void setupRenewTimer(Context context) {
229231 Intent renewIntent = new Intent (ACTION_RENEW_ALARMS );
230232 PendingIntent pendingSetupIntent =
231233 PendingIntent .getBroadcast (context , SpecialPendingIds .RENEW_ALARM ,
232- renewIntent , PendingIntent .FLAG_UPDATE_CURRENT );
234+ renewIntent , PendingIntent .FLAG_CANCEL_CURRENT );
233235 if (Build .VERSION .SDK_INT >= 19 ) {
234236 alarmManager .setExact (
235237 AlarmManager .RTC_WAKEUP , setupDate .getTimeInMillis (), pendingSetupIntent );
0 commit comments