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

Background notification tap action is resetting navigation

Open bhushansethi opened this issue 8 years ago • 5 comments

I am trying to use react-native-notifications with react-native-navigation on Android device When app is foreground, everything works fine When app is in background, navigation is getting reset. For example, if I am on 2nd tab of navigation, clicking notification when app is in background, launches app but reset navigation to 1st tab again.

bhushansethi avatar Sep 20 '18 16:09 bhushansethi

I am trying to use react-native-notifications with react-native-navigation on Android device When app is foreground, everything works fine When app is in background, navigation is getting reset. For example, if I am on 2nd tab of navigation, clicking notification when app is in background, launches app but reset navigation to 1st tab again.

Hello! Did you found an answer on your question?

Natkarock avatar Dec 07 '18 13:12 Natkarock

I am having the same problem. I am using location services in the background, which created an app icon in the top "notification area" of the device. Clicking app icon restarts the application - Navigation.events().registerAppLaunchedListener is triggered again. For me, it seems like the new instance of the application is opened on top of the previous instance, since when I press the back button of the device, the new instance disappears and the first, the original screen is "restored" (it was under the new screen)

gusoskar avatar Dec 14 '18 05:12 gusoskar

I am having the same problem. I am using location services in the background, which created an app icon in the top "notification area" of the device. Clicking app icon restarts the application - Navigation.events().registerAppLaunchedListener is triggered again. For me, it seems like the new instance of the application is opened on top of the previous instance, since when I press the back button of the device, the new instance disappears and the first, the original screen is "restored" (it was under the new screen)

I added singleTop parameter in MainActivity in AndroidManifest. Try this.

<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

Natkarock avatar Dec 14 '18 10:12 Natkarock

This is the answer to the problem https://github.com/wix/react-native-navigation/issues/4007#issuecomment-447289559. Guys, remember to post your solutions before closing the issue. Thank you @Natkarock!

gusoskar avatar Dec 17 '18 01:12 gusoskar

We tried the same with Android 11 emulator and it's not working. is there anything else we need to do around it?

vineethvijayan314 avatar Feb 02 '23 13:02 vineethvijayan314