question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic Links and android:launchMode

See original GitHub issue

While 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:

  1. The App is in the background
  2. User clicks on a Dynamic Link somewhere
  3. 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.
  4. The new instance does not register the onDynamicLinkCallback → The App seems to start as usual but wont handle the Dynamic Link.
  5. If you open up the Multi Tasking App Switcher you see your App twice.
  6. 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:open
  • Created 5 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hackerunetcommented, Sep 5, 2018

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?

1reaction
EddyVerbruggencommented, Mar 30, 2019

Likewise!

Read more comments on GitHub >

github_iconTop Results From Across the Web

android firebase dynamic link is only working if app is installed ...
android:launchMode ="singleTask". and try to access the dynamic link data in next activity if cannot read in splash.
Read more >
Create Dynamic Links on Android - Firebase
You can create short or long Dynamic Links with the Firebase Dynamic Links Builder API. This API accepts either a long Dynamic Link...
Read more >
Firebase Dynamic Links — Making the User lazy
In this post, I'm going to talk about Firebase Dynamic Links, what these links are and how to leverage them to improve user...
Read more >
Deep Links in Android: Getting Started - RayWenderlich.com
Firebase Dynamic Links usually work across different platforms in a similar manner even if your app ... android:launchMode="singleTask".
Read more >
cordova-plugin-firebase-dynamiclinks - npm
<preference name="AndroidLaunchMode" value="singleTask" />. To get callback for new app installs on iOS your dynamic link MUST have an app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found