Delete alarm from AlarmManager using cancel() – Android

Try this flag:

PendingIntent.FLAG_UPDATE_CURRENT

Instead of:

PendingIntent.FLAG_CANCEL_CURRENT 

So the PendingIntent will look like this:

PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 
        alert.idAlert, intent, PendingIntent.FLAG_UPDATE_CURRENT)  

(Make sure that you use same alert object and mContext!)

A side note: If you want one global AlarmManager, put the AlarmManager in a static variable (and initialize it only if it’s null).

Leave a Comment