Firebase Dynamic Links after installation

from the CommonsWare Community archives

At March 16, 2020, 4:03pm, islam.farid2100 asked:

I have an application with different flavors, and I am working on Debug Flavor. I am trying to simulate that the user click on the dynamic link when the app is not installed, so I click on the link till the browser forward me to google play [to an undefined google play page because it is a debug app] and then I run again from the android studio but I receive nothing please find the below code in the oncreate of the launcherMainActivity

     FirebaseDynamicLinks.getInstance()
                .getDynamicLink(getIntent())
                .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                    @Override
                    public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                        // Get deep link from result (may be null if no link is found)
                        Uri deepLink = null;
                        if (pendingDynamicLinkData != null) {
                            deepLink = pendingDynamicLinkData.getLink();
                        }
                        Log.i("LauncherActivity", ""+deepLink);

                        // Handle the deep link. For example, open the linked
                        // content, or apply promotional credit to the user's
                        // account.
                        // ...

                        // ...
                    }
                })
                .addOnFailureListener(this, new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Log.w("TAG", "getDynamicLink:onFailure", e);
                    }
                });

always Deeplink is null; however if I clicked the link when the app installed it works fine. Therefore I might be testing the wrong way not sure.


At March 16, 2020, 4:38pm, mmurphy replied:

I do not use Firebase Dynamic Links, so I have no advice — sorry!


At March 25, 2020, 11:31pm, sudokai replied:

Hi, I use Firebase Dynamic Links for my own project and your code should be fine. The problem is that you’re testing it wrong. If your app is not on Play Store, then you can’t really test if the link data survives the app install. However, you can test that clicking the link redirects you to the proper Play Store page. Just use any Google Play app that’s not installed on your phone as your link target’s fallback. Then, when you click on the link, you should see the redirection taking you to the correct Google Play page.

Once your app is on Play Store, when you click on a Dynamic Link and install the app from Play Store, you should see a Continue button instead of an Open button to open your app.