Search code examples
androidalarmmanager

How to save PendingIntent that is used to create an alarm to use later in Android


I use PengingIntent to create an alarm in android application. The question is how do I save it so it would be possible to use it in alarmManager.cancel(pendingIntent) method call even after the app has been closed and reopened again.


Solution

  • You can create the same pending intent again with the same code and use it to cancel, make sure the code to create pending intent is the exact same code