From 62f2cd8d1b6590a33a7cfed6fc9f5d2b119a1ee3 Mon Sep 17 00:00:00 2001 From: wixmobile Date: Mon, 17 Jul 2023 15:43:04 +0200 Subject: [PATCH] Change the way the initial notification is extracted from intent at application startup --- .../reactnativenotifications/RNNotificationsPackage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java b/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java index a249c6ad3..53b4030e2 100644 --- a/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java +++ b/lib/android/app/src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java @@ -95,11 +95,13 @@ private void callOnOpenedIfNeed(Activity activity) { Intent intent = activity.getIntent(); if (NotificationIntentAdapter.canHandleIntent(intent)) { Context appContext = mApplication.getApplicationContext(); - Bundle notificationData = NotificationIntentAdapter.canHandleTrampolineActivity(appContext) ? - intent.getExtras() : NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent); + Bundle notificationData = intent.getExtras(); final IPushNotification pushNotification = PushNotification.get(appContext, notificationData); if (pushNotification != null) { pushNotification.onOpened(); + // Erase notification intent after using it, to avoid looping with the same notification + // in case the app is moved to background and opened again + activity.setIntent(new Intent()); } } }