I create an alaram in my app which is calling a BroadcastReceiver to setup notifications ever day with this code:
Intent intent = new Intent(Benachrichtigung.CUSTOM_INTENT);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.set(Calendar.MINUTE, 00);
calendar.set(Calendar.SECOND, 00);
alram = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alram.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), (24 * 60 * 60 * 1000), pendingIntent);
Now I want that the user can set the time for the norification so I have to call calendar.set
with the new value. How can I overwrite the existing alarm with a new one?
calendar.set(Calendar.HOUR_OF_DAY, 9)
does it overwrite the old alarm automatically? So is the old alarm with 8 deleted and the new with 9 created automatically? – Huckster