diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java index 5b25865a..a024003a 100644 --- a/app/src/main/java/com/jens/automation2/AutomationService.java +++ b/app/src/main/java/com/jens/automation2/AutomationService.java @@ -321,7 +321,9 @@ public class AutomationService extends Service implements OnInitListener ReceiverCoordinator.applySettingsAndRules(); DateTimeListener.setOrResetAlarms(); - CalendarReceiver.armOrRearmTimer(); + + if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance())) + CalendarReceiver.armOrRearmTimer(); } @Override diff --git a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java index 914b56d5..bfce2cf6 100644 --- a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java +++ b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java @@ -1,5 +1,6 @@ package com.jens.automation2; +import android.Manifest; import android.os.Build; import android.util.Log; @@ -212,7 +213,7 @@ public class ReceiverCoordinator if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.screenState)) ScreenStateReceiver.startScreenStateReceiver(AutomationService.getInstance()); - if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent)) + if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance())) CalendarReceiver.startCalendarReceiver(AutomationService.getInstance()); } @@ -469,7 +470,7 @@ public class ReceiverCoordinator } } - if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent)) + if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance())) { if(!CalendarReceiver.getInstance().isListenerRunning()) CalendarReceiver.getInstance().startListener(AutomationService.getInstance()); diff --git a/fastlane/metadata/android/en-US/changelogs/142.txt b/fastlane/metadata/android/en-US/changelogs/142.txt index d6db5f2d..bd975371 100644 --- a/fastlane/metadata/android/en-US/changelogs/142.txt +++ b/fastlane/metadata/android/en-US/changelogs/142.txt @@ -1,2 +1,3 @@ * Fixed: Calendar trigger hidden from Play version -* Fixed: Parameters not correctly supplied when starting other apps \ No newline at end of file +* Fixed: Parameters not correctly supplied when starting other apps +* Fixed: Crash when exiting settings while service is running \ No newline at end of file