私の目標は、すべてのイベントに対してアラームを発生させることですが、毎回発生するのはeventsDb.getFavouriteEvents()1 つだけです。
私の意見では、設定が原因である可能性がありますがPendingIntent.FLAG_UPDATE_CURRENT、意図的にエクストラを投稿するには、このフラグが必要です。このフラグを設定せずに意図的にエクストラを投稿する方法はありますか?
このクラスでキャンセルしているためPendinIntents、 Collection ( ) に格納しています。pendingIntentsonDestroy()Service
これは からのコードですonCreate():
for(Event event : eventsDB.getFavouriteEvents()) {
Intent intent = new Intent(AlarmReciever.ONCOMING_EVENT);
intent.putExtra(Event.TITLE, event.getTitle());
PendingIntent pendingIntent = PendingIntent.getBroadcast(EventAlarmService.this, 0, intent,
Intent.FLAG_GRANT_READ_URI_PERMISSION | PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.set(AlarmManager.RTC_WAKEUP, event.getTime(), pendingIntent);
pendingIntents.add(pendingIntent);
}
手伝ってくれてありがとう!