Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check time of existing PendingIntent in AlarmManager

Is it possible to query the Android AlarmManager for the time of the next alarm for a given PendingIntent? I know I can cancel one using the .cancel(PendingIntent) function, and I can update one using .set(), but is it possible to "query" one? I use something like this to see if one is already scheduled:

    PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_NO_CREATE);

If sender == null, then one is already scheduled. I'd really like to know "for what time?" if possible.

I know I could save this in a database or other location, when I set it, but I'd really like query "the official source" to be sure. Possible?

like image 216
eselk Avatar asked Feb 04 '12 01:02

eselk


1 Answers

Is it possible to query the Android AlarmManager for the time of the next alarm for a given PendingIntent?

Unfortunately, no. 'AlarmManager' is a write-only interface.

like image 149
CommonsWare Avatar answered Nov 12 '22 10:11

CommonsWare