react-native-notifications icon indicating copy to clipboard operation
react-native-notifications copied to clipboard

Can't open Application when touch in Notification android

Open mrminhhuy opened this issue 7 years ago • 6 comments

In version 1.2.52, it have this bug. You can fix it Go to PushNotification.java in folder: react-native-notifications/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java Add this function in end class PushNotification protected void launchOrResumeApp() { final Intent intent = mAppLaunchHelper.getLaunchIntent(mContext); mContext.startActivity(intent); } After, add to call this function in digestNotification function, like: if (!mAppLifecycleFacade.isReactInitialized()) { setAsInitialNotification(); launchOrResumeApp(); // call function return; } and add to call in function dispatchUponVisibility, like: protected void dispatchUponVisibility() { mAppLifecycleFacade.addVisibilityListener(getIntermediateAppVisibilityListener()); launchOrResumeApp(); // // call function } Hope it help you.

mrminhhuy avatar Mar 13 '19 08:03 mrminhhuy

This solution works if the app is not closed. If the app is closed, then tapping on the notification will not open the app and the notification will disappear from the notification center.

skumarcm avatar Mar 21 '19 00:03 skumarcm

This solution works if the app is not closed. If the app is closed, then tapping on the notification will not open the app and the notification will disappear from the notification center. you can handle in JS code with Opened function to direction to screen that you need.

mrminhhuy avatar Mar 21 '19 04:03 mrminhhuy

@huyvm I'm sorry, but your answer is a bit vague and I can't quite get a grasp on the solution. Could you please elaborate on the part where you say:

you can handle in JS code with Opened function to direction to screen that you need.

?

Thank you very much

sorin-f-wiredelta avatar Mar 21 '19 08:03 sorin-f-wiredelta

Follow this code, in JS code: NotificationsAndroid.setNotificationOpenedListener((notification) => { console.log("Notification opened by device user", notification.getData()); // direct to screen });

mrminhhuy avatar Mar 21 '19 08:03 mrminhhuy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Jul 24 '19 18:07 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Jul 31 '19 19:07 stale[bot]