1
如何更新報警時間和日期如何通過取消舊警報和添加新警報來更新警報?
Intent i = new Intent("com.appsinbox.mydiary.remainder.demoactivity");
PendingIntent operation = PendingIntent.getActivity(getBaseContext(), 0, i, Intent.FLAG_ACTIVITY_NEW_TASK);
AlarmManager alarmManager = (AlarmManager) getBaseContext().getSystemService(ALARM_SERVICE);
GregorianCalendar calendar = new GregorianCalendar(year,month,day, 7, 00);
long alarm_time = calendar.getTimeInMillis();
alarmManager.set(AlarmManager.RTC_WAKEUP , alarm_time , operation);
Toast.makeText(getBaseContext(), "Alarm is set successfully",Toast.LENGTH_SHORT).show();
在待處理的意圖中使用標誌FLAG_UPDATE_CURRENT。 – VVB 2014-11-05 05:47:31