diff --git a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java index 654de39..4af9b4e 100644 --- a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java +++ b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java @@ -291,7 +291,10 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis if (alarmManager == null) { alarmManager = (AlarmManager) Miscellaneous.getAnyContext().getSystemService(Context.ALARM_SERVICE); + } + if(pi == null) + { Intent intent = new Intent(Miscellaneous.getAnyContext(), CalendarReceiver.class); intent.setAction(calendarAlarmAction); pi = PendingIntent.getBroadcast(AutomationService.getInstance(), 0, intent, 0); @@ -364,7 +367,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis if (nextWakeup == null || event.end.getTimeInMillis() < nextWakeup.getTimeInMillis()) { nextWakeup = event.end; - Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Choosing end of event " + event.title + " as next wakeup.", 5); + Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Chose end of event " + event.title + " as next wakeup.", 5); if(!alarmHasChanged) alarmHasChanged = true; } @@ -374,7 +377,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis if (nextWakeup == null || event.start.getTimeInMillis() < nextWakeup.getTimeInMillis()) { nextWakeup = event.start; - Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Choosing start of event " + event.title + " as next wakeup.", 5); + Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Chose start of event " + event.title + " as next wakeup.", 5); if(!alarmHasChanged) alarmHasChanged = true; }