Android Question Fused Location Provider error java.lang.IllegalStateException: GoogleApiClient is not connected yet.

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.

I've got this error today - never seen it before.

Fused Location Provider error java.lang.IllegalStateException: GoogleApiClient is not connected yet.

What does it mean and what to do?

Could it be caused by the Airplane mode On or the used turned off Location permission?

Error happened here

B4X:
Sub UpdateUI
    
    Try
    
        Main.Latitude=LastLocation.Latitude
        Main.Longitude=LastLocation.Longitude
    
        'Log("Lat=" & Main.Latitude & " Long=" & Main.Longitude)
        FusedLocationProvider1.RemoveLocationUpdates
        FusedLocationProvider1.Disconnect

        ProgressDialogHide
        

    Catch
        ProgressDialogHide
        Log("UpdateUI " & LastException.Message)
        modFun.ShowError("NursesNotes_UpdateUI " & LastException.Message)
    End Try
    
End Sub

To my understanding if we already in this sub that means that we receive lat/long already.

Thanks.
 

Alex_197

Well-Known Member
Licensed User
Longtime User
You need to provide more information. Are you able to reproduce it? Can you post the full stack trace?
Does it happen with this project: https://www.b4x.com/android/forum/threads/fusedlocationprovider-resolution-dialog.111652/#content ?
It happened only on 1 customer's phone twice so far. I don't have this error from any other cistomers so I can't provide full stack trace.
I tried to reproduce this error myself and still can't reproduce it.
No, it doesn't happen with projects from your URL even with a airplane mode.

In my code even if I grant the location permission and while the app is running revoke this permission the only error I've got is java.lang.Exception: java.lang.SecurityException: uid 11079 does not have any of [android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION].
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Now it happens moreand more vut most of the time on Anbdroid 13. Any idea?

I tried to google it and this is what I found -
https://developers.google.com/android/guides/google-api-client:

Maybe it will help.
 
Upvote 0
Top