Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase dynamiclink onSuccess nor onFailure getting called

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?

like image 969
Sweety Bertilla Avatar asked Jan 24 '18 16:01

Sweety Bertilla


1 Answers

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.

like image 195
Khay Avatar answered Nov 14 '22 23:11

Khay