Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheduling notifications in Android

I need to be able to schedule multiple Notifications at different times in the future.

I tried doing this with an AlarmManager, but that isn't suitable, for the following reason. From AlarmManager.set(): "If there is already an alarm for this Intent scheduled (with the equality of two intents being defined by filterEquals(Intent)), then it will be removed and replaced by this one."

Guess what, the sending intents are equal, apart from different Extra's (but those don't count for filterEquals).

So how can I schedule multiple notifications, which will still be shown when my application is killed (the whole reason I tried AlarmManager)?

Thanks.

like image 450
benvd Avatar asked Feb 27 '23 07:02

benvd


1 Answers

Work out which event will occur first, schedule that, when your event fires have it schedule the next event to occur.

like image 151
Jim Blackler Avatar answered Mar 10 '23 21:03

Jim Blackler