android studio:用alarmclock.action\u discouse\u alarm解除警报

xv8emn3q  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(376)

我用这个来设置警报:

Intent intent =new Intent(AlarmClock.ACTION_SET_ALARM);
                intent.putExtra(AlarmClock.EXTRA_HOUR,settings.getInt("alarmhour", 0));
                intent.putExtra(AlarmClock.EXTRA_MINUTES,(settings.getInt("alarmminute", 0)+2));
                intent.putExtra(AlarmClock.EXTRA_MESSAGE,"Alarm123");
                intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
                startActivity(intent);

我想用这个解除警报:

Intent intent1 =new Intent(AlarmClock.ACTION_DISMISS_ALARM);
    SharedPreferences settings = getApplicationContext().getSharedPreferences("PREFS_ALARMTIME", 0);
    intent1.putExtra(AlarmClock.EXTRA_ALARM_SEARCH_MODE, AlarmClock.ALARM_SEARCH_MODE_LABEL);
    intent1.putExtra(AlarmClock.EXTRA_MESSAGE,"Alarm123");
    startActivity(intent1);

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题