im programming an android app which sets my AlarmClock.
Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
i.putExtra(AlarmClock.EXTRA_MESSAGE, "Google Cal Alarm");
i.putExtra(AlarmClock.EXTRA_HOUR, l.getHours());
i.putExtra(AlarmClock.EXTRA_MINUTES, l.getMinutes());
the problem is, that I'm doing that in a background service, but the AlarmClock pops up toasts every time the Clock is set.
开发者_如何学编程Can i prevent that?
Thanks a lot
From the docs for AlarmClock
...
The AlarmClock provider contains an Intent action and extras that can be used to start an Activity to set a new alarm in an alarm clock application. Applications that wish to receive the ACTION_SET_ALARM Intent should create an activity to handle the Intent that requires the permission com.android.alarm.permission.SET_ALARM. Applications that wish to create a new alarm should use Context.startActivity() so that the user has the option of choosing which alarm clock application to use.
This suggests to me that AlarmClock
is designed to be used in a UI context. Is there a reason why you are using it rather than AlarmManager?
精彩评论