0

I have the following code for receiving the dynamic links and it works. According to Firebase, we only get to receive the link once. What if I want the link, even when clicked multiple times, to open the activity?

Is there any way to achieve this?

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)

                    if (pendingDynamicLinkData == null) {
                        //do something
                    } else {
                        //do something
                    }
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    //do something
                }
            });

1 Answers1

0

The once is only for the deferred deep linking (e.g. if it requires installing the app first). Clicking the link when the app is installed should work each time.

Ian Barber
  • 19,765
  • 3
  • 58
  • 58
  • Hi! The first click on the link opens the app and the correct activity. The link opens the app on second try as well but it does not open to the desired activity. Is it the expected behaviour? – Ashim Neupane Jun 11 '18 at 04:58
  • Also, can you please tell me where should this code be ideally placed? Is it in onCreate, onStart or onResume? – Ashim Neupane Jun 11 '18 at 05:49
  • In our sample we use onCreate - https://github.com/firebase/quickstart-android/blob/master/dynamiclinks/app/src/main/java/com/google/firebase/quickstart/deeplinks/MainActivity.java#L66 - others should be workable as well. – Ian Barber Jun 21 '18 at 22:39