I wrote an app to turn on/off WiFi at scheduled time choosen before. The way it works is preety simple: Choose time from timepicker, then just add it. Programmatically it gets d
When you set an alarm, you pass a PendingIntent to AlarmManager. The PendingIntent wraps an Intent. When you set an alarm, AlarmManager deletes any alarms it already has scheduled that match the PendingIntent. To determine if the PendingIntents match, the following are compared:
requestCode in the PendingIntent.getBroadcast() callIntentIntentIntentComponent (package name, class name) in the IntentNOTE: "extras" in the Intent are not compared
So, if we want to reschedule an alarm, you just need to create a PendingIntent with the same requestCode, ACTION and Component as the previous one and set the alarm again. AlarmManager will remove the previous one and set the new one.
If you want to have multiple alarms scheduled in parallel, you need to ensure that either the requestCodes, the Components or the ACTIONs are different, otherwise they will overwrite each other.