Using intent ACTION_SET_ALARM to allow application

2019-09-13 09:31发布

问题:

I am attempting to write an application that automatically sets the Android default alarm based on some preset values determined by an alternate algorithm.

The alarm setting works fine using the ACTION_SET_ALARM intent, however every time I run the app, it sets a NEW alarm. I'm wondering if there is any way to instead have one unique alarm set to update every time the activity sets the alarm (so that there are not hundreds of new alarms in the Android alarm application).

I will provide code excerpts if necessary, however it seems that this question can be answered without specific examples. NOTE: I am not using the Android alarm system that is intended for informing other activities of certain events, but rather the actual Android alarm that users will utilize to wake up in the morning.

Thank you in advance for any assistance!

回答1:

It turns out that this is actually not possible given the scope of my problem. Instead, I had to work with a list of manufacturer specific alarm clocks (here) and handle each case specifically.

In the case where the user is still going to use the open source alarm, I had to remove the ACTION_SET_ALARM intent as there is currently no workaround for the redundant alarms issue. The user would have to manually delete each alarm.