From 3c8c0f14f2f2e60096976adf6362bf14423003ca Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 6 Dec 2023 23:44:40 +0100 Subject: [PATCH] Fixed bug in broadcast receiver trigger --- .../com/jens/automation2/receivers/BroadcastListener.java | 8 ++++++-- fastlane/metadata/android/en-US/changelogs/138.txt | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/receivers/BroadcastListener.java b/app/src/main/java/com/jens/automation2/receivers/BroadcastListener.java index 204a3b5d..b994a3e7 100644 --- a/app/src/main/java/com/jens/automation2/receivers/BroadcastListener.java +++ b/app/src/main/java/com/jens/automation2/receivers/BroadcastListener.java @@ -52,9 +52,13 @@ public class BroadcastListener extends android.content.BroadcastReceiver impleme { broadcastsCollection.add(new EventOccurrence(Calendar.getInstance(), intent.getAction())); - for(String key : intent.getExtras().keySet()) + Miscellaneous.logEvent("i", "Broadcast received", "Broadcast " + intent.getAction() + " received.", 4); + if(intent.getExtras() != null && intent.getExtras().size() > 0) { - Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4); + for (String key : intent.getExtras().keySet()) + { + Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4); + } } ArrayList ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.broadcastReceived); diff --git a/fastlane/metadata/android/en-US/changelogs/138.txt b/fastlane/metadata/android/en-US/changelogs/138.txt index 5bed4132..ae7eecd7 100644 --- a/fastlane/metadata/android/en-US/changelogs/138.txt +++ b/fastlane/metadata/android/en-US/changelogs/138.txt @@ -1 +1,2 @@ -* Fixed: Overlay permission for start other program action only required if startByActivity() is selected \ No newline at end of file +* Fixed: Overlay permission for start other program action only required if startByActivity() is selected +* Fixed: Broadcast receiver trigger would not trigger anything, but crash \ No newline at end of file