7

I am using the below code

        FirebaseDynamicLinks.getInstance()
                            .getDynamicLink(getIntent())
                            .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                                @Override
                                public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
...
     }
                            })
                            .addOnFailureListener(this, new OnFailureListener() {
                                @Override
                                public void onFailure(@NonNull Exception e) {

                                }
                            });

I some devices, when I dont launch threw a deeplink, onSuccess is called with pendingDynamicLinkData == null, which is fine but on some devices, both onSuccess and onFailure not getting called at all. How to fix this?

Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
Sweety Bertilla
  • 972
  • 10
  • 35
  • Have you confirmed that the link handling code is getting called in those cases - e.g. if you put a breakpoint on the getDynamicLink line, it is being called? – Ian Barber Jan 30 '18 at 00:16
  • 3
    the issue was with playservices not upgraded in those devices.. Later I noticed in the notification bar it asked to upgrade playservcise to use firebase – Sweety Bertilla Feb 01 '18 at 15:53
  • i also has the same issue, Please find a solution, not sure if only when launched through Android studio adb – Vaishakh Jul 13 '18 at 18:21
  • I had a similar issue, 1st solution I found was with play service version check if in the logs are you getting error something like "Expected play service version XXXX but found version XXXX". It started working on some device but still I'm the issue persist for some devices particularly on "One+" devices. Please Answer if anyone has any more leads to solve this issue. – Khay Oct 14 '20 at 11:21
  • I suggest posting a different Stack Overflow question instead of tracking this old question. The issue may have something to do with how your app is set up or with the parameters configured on the Dynamic Link. – Omatt Oct 17 '20 at 14:39
  • Thanks for the suggestion @Omatt, you were somewhat correct, I finally figured it out and posted an answer too, in case anybody hits upon the same issue. – Khay Oct 18 '20 at 16:05

1 Answers1

1

If I'm getting you right you mean to say there are two cases happening inside your code with your firebase dynamic links:-

Case 1 -> On some devices the onSuccess(PendingDynamicLinkData pendingDynamicLinkData) method is being called. ( which is the expected behaviour)

Case 2 -> On some devices Neither the onSuccess(PendingDynamicLinkData pendingDynamicLinkData) callback is being called nor onFailure(Exception e).

I think this can if you are not executing your "Firebase.getInstance()..." part of the code in the activity which is currently in front of the user, or if the activity where you wrote this code is now in the background.

For Ex: If you execute this code( your Firebase.getInstance()... part of code) in your SplashActivity, which disappears usually after few seconds and your MainActivity is now present in front of the user, then in some devices Neither your OnSuccess(PendingDynamicLinkData pendingDynamicLinkData) nor your onFailure(Exception e) callback will be called.

Khay
  • 981
  • 1
  • 10
  • 22