Dynamic Links and android:launchMode
See original GitHub issueWhile Dynamic Links seem to work great when the App is completely closed they just don’t work correctly when the App is running in the background for me. I think I’ve found the problem but I don’t know how to fix it:
- The App is in the background
- User clicks on a Dynamic Link somewhere
- Because the activities launch mode falls back to standard (The system always creates a new instance of the activity in the target task and routes the intent to it.) the system creates a new instance.
- The new instance does not register the
onDynamicLinkCallback
→ The App seems to start as usual but wont handle the Dynamic Link. - If you open up the Multi Tasking App Switcher you see your App twice.
- If you switch to the other App instance the Dynamic Link is getting handled properly because on that “old” instance the
onDynamicLinkCallback
is still registered.
I have tried setting the launch mode to singleTask
on the com.tns.NativeScriptActivity
Activity as suggested in the React Native Documentation.
This prevents the weird multi instance but the Dynamic Link is still not handled when the App is in the background.
Important: The above behavior seems to only apply to a handler that triggers a navigation. When the handler simply triggers an alert it seems to work just fine.
Here’s a handler that I can reliably reproduce the issue with:
firebase.init(
{
persist: true,
onDynamicLinkCallback: (result) => {
this.routerExtensions.navigate(
["/about"]
);
}
}
)
I’m not really sure and it’s just a wild guess but I think this could maybe be related to https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/534
I have already tried
firebase.addOnDynamicLinkReceivedCallback
. It did not work unfortunately.
I would have shared some repository but I don’t know if it makes a lot of sense. (You will need to signing certificate fingerprints in your firebase project etc…)
"tns-ios": {
"version": "4.0.1"
},
"tns-android": {
"version": "4.0.1"
}
"nativescript-plugin-firebase": "^5.3.0",
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (5 by maintainers)
Top GitHub Comments
I have an issue related to this one, if the notification is pressed when the application is closed I get my application launched back again but the onTap action in my configuration object does not get called so I cannot perform any internal navigation., the only case it works is when I receive a notification but the application is in foreground, this does not call the onMessageReceivedCallback function, any thoughts?
Likewise!