Background notification tap action is resetting navigation
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.
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?
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 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>
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!
We tried the same with Android 11 emulator and it's not working. is there anything else we need to do around it?