Reputation: 425
I would like to know if there is a way to programmatically create an alarm clock event? I know with API 9, you can use the AlarmClock class set parameters and then pass them to the activity, but I would like to mimic this same action inside my app, without pulling up this activity.
Upvotes: 0
Views: 1030
Reputation: 11
You can still use the AlarmClock API. If you want to skip bringing up the AlarmClock
activity add this extra:
i.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
Though I have experienced a known Android issue where this extra causes the alarm to be created and saved, but it doesn't arm correctly (it won't ring go off when the time comes even though it appears as on). The work around we found for this issue was to call startActivity()
twice. Thus far it has been working perfectly.
Upvotes: 1