Andrew Lam
Andrew Lam

Reputation: 1391

Firebase Authentication issue getGoogleApiForMethod() returned Gms

In my current implementation of Firebase Authentication and Real Time Database (RTDB) in my new android app (using the MVP architecture). Instead of putting the AuthStateListener logics in my MainActivity View class. I placed it in the Presenter class. The Presenter class attaches or detaches the listener in response to the view lifecycle (onResume calls to attach the listener in presenter, onPause calls to detach the listener in presenter).

Issue: after the devices goes inactive (probably server closes off the connection), goes active again. The user is still logged in (expected behavior), but unexpectedly, the logged in user can’t access Firebase RTDB anymore, and yet the RTDB doesn't throw any read/write permission denied errors. Any database read/write operation from that point on won't work, confirmed from the Firebase Console.

The log cat repeatedly shows the following warning when this issue occurs, seems to be a back-off login attempt strategy in play?

12-10 14:09:23.671 13076-13271/appname W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms

12-10 14:09:27.191 13076-13271/ appname W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms

12-10 14:09:28.182 13076-13271/ appname W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms

12-10 14:09:29.659 13076-13271/ appname W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms

The issue would be resolved if the user signed out, and then sign in and become active again. When the user is active, any NEW read/write operations would go though, but the previous ones were not persisted or retried.

The relevant version I’m using are

// Firebase
implementation "com.firebaseui:firebase-ui-auth:3.1.0"
implementation "com.google.firebase:firebase-database:11.6.2"
implementation "com.google.firebase:firebase-auth:11.6.2"

Is there any best practice information for implementing Firebase Auth with database within a MVP structure in an Android app?

Upvotes: 2

Views: 2805

Answers (2)

Mario Cristerna
Mario Cristerna

Reputation: 9

It just happened to me something similar, same warning, problem with email/password auth... it was that I forgot to update the SHA-1 fingerprints for my project, after I upgraded my compuer OS... In your case, maybe is something related with your API keys?

Upvotes: 0

user8890895
user8890895

Reputation:

You should use

firebase-database = '11.6.2' 
firebase-ui-auth = '3.1.0'

as well.

Upvotes: 1

Related Questions