使用广播接收器,我怎样才能让闹钟管理员在日/日/时间内重复一次?
public void startAlert(String time, String title) {
long timeInMillis = Long.decode(time);
intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("myTitle", title);
alarmmanager = (AlarmManager) getSystemService(ALARM_SERVICE);
pendingIntent = PendingIntent.getBroadcast(this, (int) Long.parseLong(time), intent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmmanager.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
}
答案 0 :(得分:0)
使用setRepeating
代替set
这是正确的语法 -
alarmmanager.setRepeating(AlarmManager.RTC_WAKEUP,
startUpTime, AlarmManager.INTERVAL_DAY, pendingIntent);
答案 1 :(得分:0)
我认为你可以使用setRepeating和另一个question的自定义日期。
alarmmanager.setRepeating(AlarmManager.RTC_WAKEUP, startUpTime,AlarmManager.INTERVAL_DAY,pendingIntent);