1
我想在用戶定義時間安排重複警報。對於我使用下面的代碼PutExtras與重複警報器
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("id", id);
intent.putExtra("ontime", flag_ontime);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
am.setRepeating(AlarmManager.RTC_WAKEUP,
SystemClock.elapsedRealtime() +calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pendingIntent);
一切工作正常...我還報警開火所需的時間,但在我的接收器,我總是得到沒有通過一個
AlarmReceiver.class
意圖只是默認值long id = intent.getLongExtra("id", -1);
boolean ontime = intent.getBooleanExtra("ontime", false);
這裏ID總是-1,準時是假的....請幫我