FirebaseUI-Android: onActivityResult not fired!

I’m using the new version 0.4.1 of the auth library (on a device with Android 6.0.1).

I’m trying to use the Google sign in provider, launching this intent:

startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setProviders(
                                AuthUI.EMAIL_PROVIDER,
                                AuthUI.GOOGLE_PROVIDER)
                        .build(),
                RC_SIGN_IN);

When i login with email&password everythings works fine, but when i try to login with the google sign in button, i select the account and i can see a loader for about 3-4 seconds: then the loader disappears and nothing else happens, i still remain into the activity with the two login buttons. onActivityResult isn’t fired and i don’t know if login was successful or not.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 39 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Any login method makes my app to close. No error msg is printed. It just closes.

I was having this issue because I had set no history for the activity calling the firebase ui in the manifest file. Removing android:noHistory="true" from the activity inside manifest solved the problem

Hello, I must apologize: all our (my and my team’s) problems were related to the keystore (thank you very much @samtstern … without you we would have continued to try without success): one of our colleagues changed the SHA1 code on firebase for some personal trials (without warning us) and then we started to have problems. Even though I cannot understand why on one smartphone it worked even with the wrong key, now, after updating all key related settings (SHA1 on firebase, google-services.json in the app) the login works with all the devices. Thank you again and sorry!

I was struggling with this for a while and I had a combination of factors (some may be irrelevant but I caught them when debugging this issue nevertheless):

  1. Forgotten to include internet permissions.
  2. Not including the play services library as pointed out by @tehras.
  3. apply plugin: 'com.google.gms.google-services' not being at the bottom of the build.gradle file (had it at the top instead). Read here.
  4. Wrong SHA1, I had initially created the project from a different computer so SHA1 for the debug key on that computer is different (obviously). Quick and easy way to get the SHA1.
  5. Package name wrong in google-services.json file. I had two android apps on the same Firebase project each with a different package name. Even though I downloaded the correct google-services.json file from the Project Settings page, the file being downloaded was always for the first app I created (probably a bug in the Firebase Console). I had to delete both my apps (not the project) and create a new app to get the correct file.

Hope this helps.

I was chasing down a similar bug for a long time, but it was an issue with my activity lifecycle.

I had some code in my onStart() method which checked if a user was logged in, and if so moved to another activity. This was bypassing the onActivityResult() method.

Moving my log in check into the onResume() method allowed onActivityResult() to be fired properly.

FYI, I was following this guidance, which does not specify what part of the Activity lifecycle is best to check the log in status. It was my fault that I didn’t know whe onActivityResult() is called! https://firebase.google.com/docs/auth/android/manage-users#get_the_currently_signed-in_user

I had this problem too! Turned out it was caused by not having internet connectivity on the device. The email auth provider would then throw an internal error and the activity would not finish.