Android AlarmClock search by label

2019-07-15 04:03发布

问题:

I want to use an Intent with android.provider.AlarmClock to dismiss (ACTION_DISMISS_ALARM) an specific Alarm. I want to use ALARM_SEARCH_MODE_LABEL to select the alarm. However, I have no idea how I can set the label to search for.

Intent i = new Intent(AlarmClock.ACTION_DISMISS_ALARM);
i.putExtra(AlarmClock.EXTRA_ALARM_SEARCH_MODE, AlarmClock.ALARM_SEARCH_MODE_LABEL);
startActivity(i);

Can someone help me complete the code?

回答1:

Seems like it is:

intent.putExtra(AlarmClock.EXTRA_MESSAGE, label)

This seems to result in deleting the entry with that label.