Android Question Delay on getting latitude and longitude

kris A

Member
Licensed User
Longtime User
I have some case, when i am using whatsapp to share my location, it return my exact location accuratelly and fast,
meanwhile in the same time, i am using fusedlocationprovider library (https://www.b4x.com/android/forum/threads/fusedlocationprovider.50614/) to be used in my program but it slow to get my location and often return nothing

any advice to fasten get my location using fusedlocationprovider library?

This is my code :
B4X:
Sub Activity_Resume
    If FusedLocationProvider1.IsInitialized Then
        Log("FusedLocationProvider1 Connect")
        FusedLocationProvider1.Connect
    End If
End Sub

Sub FusedLocationProvider1_ConnectionSuccess
    Dim LocationRequest1 As LocationRequest
    LocationRequest1.Initialize
    LocationRequest1.SetInterval(1000)    '    1000 milliseconds
    LocationRequest1.SetPriority(LocationRequest1.Priority.PRIORITY_HIGH_ACCURACY)
    LocationRequest1.SetSmallestDisplacement(1)    '    1 meter
    FusedLocationProvider1.RequestLocationUpdates(LocationRequest1)
End Sub

Sub FusedLocationProvider1_LocationChanged(Location1 As Location)
    log("FusedLocationProvider1_LocationChanged")
    Log(Location1.Latitude &" - "& Location1.Longitude)
End Sub

Kindly please help this problem
 
Top