Alex K
Alex K

Reputation: 5212

How to check if repeating alarm is active in android?

I saw a lot of questions and answers about it. I found that I can cancel the alarms using

.cancel( PendingIntent )

The problem is when I check if the alarm is set. To check it I use:

boolean alarmUp = (PendingIntent.getBroadcast(BackgroundService.this, pendingIntentRequestCode, intent, pendingIntent.FLAG_NO_CREATE) != null);

But I always get true as result. The only way that I get false is when I cancel the pendingIntent.

Why is that? and How can I check only for alarm manager and not for pending intent?

EDIT: I did a little check and found that .cancel is working. But how can I check if the alarm is active or not?

Upvotes: 3

Views: 710

Answers (1)

David Wasser
David Wasser

Reputation: 95578

Unfortunately, you can't :-(

One of the things that is really lacking in Android is the ability to query the AlarmManager and get information about registered alarms.

Upvotes: 4

Related Questions