Android Question Solved: FirebaseAuth - Error - No Network Connection

Robert Valentino

Well-Known Member
Licensed User
Longtime User
When I try to log someone in with
B4X:
FirebaseAuth.SignInWithGoogle
and they are NOT connected to the internet the sign in of course fails (shown below) but
I never get a response that I can do anything with. My code
B4X:
FirebaseAuth_SignedIn(User As FirebaseUser)
never gets called

B4X:
SignInWithGoogle called
SignInWithGoogle.ResultArrived
ResultArrived Success
** Activity (main) Resume **
firebaseAuthWithGoogle success: false
error: com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host) has occurred.

This is easy to test on a non-cell phone device (tablet) just turn off the internet connection and try to sign the user on from your code. I guess this would also fail if the users cell phone was in a dead sport.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Fix didn't work
I have
B4X:
#Region FirebaseAuth_SignedIn
Public  Sub FirebaseAuth_SignedIn(User As FirebaseUser)
            If  User.IsInitialized Then
                LogColor($"${mClassName}::FirebaseAuth_SignedIn - ${User.DisplayName}"$, Colors.Red)
            Else
                LogColor($"${mClassName}::FirebaseAuth_SignedIn - No Body Signed In"$, Colors.Red)                
            End If
End Sub
#end Region

#Region FirebaseAuth_SignError
Public  Sub FirebaseAuth_SignError(Error As Exception)
            LogColor($"${mClassName}::FirebaseAuth_SignedError  Exception${Error.Message}"$, Colors.Red)                        
End Sub
#end Region

When things work right SignedIn gets called. But SignError never gets called.

Here is how I am testing this.
Have my routine call sign out ->> force user to sign out
Have user sign in
When Google Sign In list shows up terminate program
Disable internet access
When program starts again shows the Google Sign in list when I pick someone to sign in as (now not connected to internet)
FirebaseAuth cannot sign in and I see this message in logs - but SignError never gets called

B4X:
SignInWithGoogle.ResultArrived
ResultArrived Error: Status{statusCode=NETWORK_ERROR, resolution=null}, null
** Activity (main) Resume **
Main::Acitivy_Resume

Really sorry about this. Probably better I make a ServerSocket and check MyIp
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
My humble apologizes.
I had replaced the ones I had (which were in my local libraries).
Didn't realized they were now internal (turns out I had FirebaseStorage libraries there as well)

This is not the 1st time I've had this happen where local libraries became internal.
Guess when I have some time I shoI'll write a B4J program to compare libraries
 
Upvote 0
Top