From 502c7f9fc16eb23a562dd559fbe17f36e2aeaccb Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 24 Apr 2024 13:38:00 +0200 Subject: [PATCH] Fixed crash in NotificationBroadcastReceiver if coreContext isn't created when intent is received --- .../linphone/notifications/NotificationBroadcastReceiver.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt b/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt index 1f21a7ad9..b05dcccad 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt @@ -38,6 +38,11 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { "$TAG Got notification broadcast for ID [$notificationId]" ) + // Wait for coreContext to be ready to handle intent + while (!coreContext.isReady()) { + Thread.sleep(50) + } + if (intent.action == NotificationsManager.INTENT_ANSWER_CALL_NOTIF_ACTION || intent.action == NotificationsManager.INTENT_HANGUP_CALL_NOTIF_ACTION) { handleCallIntent(intent, notificationId) } else if (intent.action == NotificationsManager.INTENT_REPLY_MESSAGE_NOTIF_ACTION || intent.action == NotificationsManager.INTENT_MARK_MESSAGE_AS_READ_NOTIF_ACTION) {