I have an application that allows the user to set alarms at different times. It currently uses AlarmManager plus BroadcastReceiver and AlertDialog to alert the user of an alarm.
I would like to see if my application can use the built-in alarm. I know that I can set the alarm in this way:
Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); i.putExtra(AlarmClock.EXTRA_HOUR, new Date(alarm.getTime()).getHours()); i.putExtra(AlarmClock.EXTRA_MINUTES, new Date(alarm.getTime()).getMinutes()); i.putExtra(AlarmClock.EXTRA_MINUTES, alarm.getDescription()); i.putExtra(AlarmClock.EXTRA_SKIP_UI, true); context.startActivity(i);
but this creates two problems:
- There seems to be no way to schedule an alarm for> 24 hours in the future.
- The built-in alarm in Android only allows you to configure 10 alarms
As work on point 1, I could use AlarmManager to set an alarm for users within 24 hours. However, this leaves me with point 2 - ideally, I need a way to remove the alarm from the Android alarm after they have been executed (to avoid triggering alarms in the application), but cannot find the list of alarms and delete them.
Is this possible, or do I need to stick with the manual AlarmManager / AlertDialog approach?
barry source share