diff --git a/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java index ba5e1c3238f22000b3127ba53f9a54120a7b2b76..2c970e940693c796645d42d7ef80c5cd1e691392 100644 --- a/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +++ b/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java @@ -104,6 +104,7 @@ public class PushNotification implements IPushNotification { protected void digestNotification() { if (!mAppLifecycleFacade.isReactInitialized()) { setAsInitialNotification(); + launchOrResumeApp(); return; } @@ -133,6 +134,10 @@ public class PushNotification implements IPushNotification { protected void dispatchUponVisibility() { mAppLifecycleFacade.addVisibilityListener(getIntermediateAppVisibilityListener()); + + // Make the app visible so that we'll dispatch the notification opening when visibility changes to 'true' (see + // above listener registration). + launchOrResumeApp(); } protected AppVisibilityListener getIntermediateAppVisibilityListener() { @@ -204,4 +209,9 @@ public class PushNotification implements IPushNotification { private void notifyOpenedToJS() { mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, mNotificationProps.asBundle(), mAppLifecycleFacade.getRunningReactContext()); } + + protected void launchOrResumeApp() { + final Intent intent = mAppLaunchHelper.getLaunchIntent(mContext); + mContext.startActivity(intent); + } } diff --git a/package.json b/package.json index 4f3b9577e0668d25257a7ef5549305352a430117..83edee172f814f45a753533639dc8c978da33815 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-notifications", - "version": "1.2.52", + "version": "1.2.6", "description": "Advanced Push Notifications (Silent, interactive notifications) for iOS & Android", "author": "Lidan Hifi ", "license": "MIT",