Cancelling a PendingIntent
Solution 1:
Where you want to cancel it, you would do the following (somewhere else in your code base):
PendingIntent.getBroadcast(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT).cancel();
where intent
is the same one as referenced in your code above. PendingIntent.getBroadcast(...)
using the PendingIntent.FLAG_UPDATE_CURRENT
will return a reference to the existing one already created, or create one if it doesn't currently exist.