Is there any way to get a list of all the active alarms in the android device programmatically in our application programmatically.Just point me out to some links that can be of help I am basically trying to give the user the facility of viewing all the alarms in his device so i want to get a list of all the active alarms in the device.
No, AFAIK you can't do that programmatically so showing that info to a user in UI is not feasible.
However for your own reference you can dump the alarm data via
adb shell dumpsys alarm
You don't need root permission for that.
But what you get from above could be very confusing to understand. In order to understand that dump completely you should check out morphatic's answer here.
Short answer: you can't.
The alarm manager gives no visibility to the alarms currently scheduled in the system. Every app that uses alarm manager must persist the state of each alarm that they set.
However you can get a list via adb as described in this question Get list of active PendingIntents in AlarmManager. And an app could get a system dump and get the alarms that way but that would require root.
If you mean by active alarms, the ones in the device's Alarm Clock Application, I think you can. Try checking out the methods from Here.
However, if you mean that you want to see all alarms created by AlarmManager on your device, then unfortunately you can not do it programatically.
But, you can view the dump data in a text file like this:
adb shell dumpsys alarm > dump.txt
You can get the next alarm that is scheduled (docs)
getSystemService(AlarmManager::class.java).nextAlarmClock.triggerTime
Returns the time at which the alarm is going to trigger. This value is UTC wall clock time in milliseconds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With