Firebaseui-android: onActivityResult not being called

Created on 28 Jan 2017  路  12Comments  路  Source: firebase/FirebaseUI-Android

I have already read the closed issue regarding this but it was not helpful.

For some reason the onActivityResult method is no longer being called when I try to login with any method. There are no errors showing anywhere in the console and when manually debugging with logging/printing everything up to that stage is being called.

The app simply closes down after login.

Using version 1.0.0 still due to needed Firebase 9.8.0 (some test devices cannot upgrade play services higher than that right now, for some reason).

Most helpful comment

I have same issue where onActivityResult is not called after I select Google account. I'm not using FirebaseUI. This issue happens only on few devices. And I'm not getting any log messages regarding this.

All 12 comments

Found the bug (potentially):

E/AsyncOperation: serviceID=16, operation=ValidateAuthServiceOperation java.lang.NullPointerException: onPostInitComplete can be called only once per call to getRemoteService at kpd.a(:com.google.android.gms:74) at kme.a(:com.google.android.gms:987) at kna.a(:com.google.android.gms:66) at kvb.a(:com.google.android.gms:284) at ekn.a(:com.google.android.gms:125) at ekn.a(:com.google.android.gms:113) at kvi.run(:com.google.android.gms:113) at kyl.run(:com.google.android.gms:450) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at lco.run(:com.google.android.gms:17) at java.lang.Thread.run(Thread.java:818)

Are you using startActivityForResult?

Yes. I should state it worked before but then stopped. I reverted all the code changes but that didn't help, which is very strange. Only thing I can think of is an update to the Google/Android repository/SDK.

I've managed to get it to work using an auth listener but that doesn't really resolve the issue just works around the problem.

@darkmantle I'm not sure what's going so the best thing I'd recommend is just updating to play services v10 and FirebaseUI v1.1.1. FirebaseUI v1.0 was riddled with bugs, memory leaks, yucky visual stuff. I'd really recommend updating!!! If you really can't, try overriding our dependencies by adding them in your gradle file with the lower version: https://github.com/firebase/FirebaseUI-Android/issues/414#issuecomment-262283040.

@SUPERCILEX To be fair I did try with latest versions, and it still happened. Which is what was annoying me. Literally spent an entire work day attempting to fix it and have no idea at all what is going on!

I'm not too bothered now since I got it working with the listener but it was frustrating.

@darkmantle Hmmm... Are you in a fragment? Have you tried different positive request codes? Are you calling super.onActivityResult?

I'm also facing same error (finding same stack).

I follow example of auth README, it works fine. However, by checking "Don't keep activities" in Developer options, crash happens at completing twitter authentication (i.e. auth twitter > Allow on "Share your email address")

02-06 00:56:01.865 1269-2726/? E/AsyncOperation: serviceID=16, operation=ValidateAuthServiceOperation
                                                 java.lang.NullPointerException: onPostInitComplete can be called only once per call to getRemoteService
                                                     at kpd.a(:com.google.android.gms:74)
                                                     at kme.a(:com.google.android.gms:987)
                                                     at kna.a(:com.google.android.gms:66)
                                                     at kvb.a(:com.google.android.gms:284)
                                                     at ekn.a(:com.google.android.gms:125)
                                                     at ekn.a(:com.google.android.gms:113)
                                                     at kvi.run(:com.google.android.gms:113)
                                                     at kyl.run(:com.google.android.gms:450)
                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                     at lco.run(:com.google.android.gms:17)
                                                     at java.lang.Thread.run(Thread.java:818)

When "Don't keep activities" is not checked, this crash doesn't happen. So, I guess there may be an issue in Activity/Fragment re-creation handling...

Using version is 1.1.1

Hope to be helpful.

I have same issue where onActivityResult is not called after I select Google account. I'm not using FirebaseUI. This issue happens only on few devices. And I'm not getting any log messages regarding this.

The same issue: Nexus 5X. onActivityResult is not called when I try to check it for RESULT_CANCEL and close the main activity. Nevertheless, AuthStateListener can listen for a successful authorization.

I can reproduce this using
com.firebaseui:firebase-ui-auth:1.2.0
play-services-*:10.2.0
com.google.firebase:firebase-auth:10.2.0

using
startActivityForResult from an AppCompatActivity

--EDIT--
I know I can get callback from AuthStateListener but I would like to have access to the provider token that I previously got from onActivityResult like below:

IdpResponse idpResponse = IdpResponse.fromResultIntent(data); String providerId = idpResponse.getProviderType(); String idpToken = idpResponse.getIdpToken();

Is it possible to obtain the provider token from FirebaseAuth?

Regarding onActivityResult not being called; it seem to be some race condition, since when having break points in firebase ui code and stepping slowly, the onActivityResult is sometimes called.

I was running into this issue and found this; I would recommend trying another return code as that fixed my problems.

For what it's worth, I was using 123 as in the example. I haven't looked much more into this.

Hi all it's been a long time since an update here. I am going to close the issue as stale but if anyone is still experiencing this on FirebaseUI 2.0+ please open a new issue and we will get back into it.

Thanks to all who contributed debugging information here, we appreciate your time and effort!

Was this page helpful?
0 / 5 - 0 ratings