Android Question Problems with Fused Location

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello All,
I am having a strange problem with Fused Location.
In my App, I have a service that every few seconds retrieves the coordinates from the fusedlocation
Every once in a while, specially in one costumer, the coordinates seem to freeze and even if the user retrieves the coordinates in two different locations, the service returns the coords for the first location.
Only by entering google maps in the same device, the fusedlocation service "unlocks"
Any idea how to solve this, other than asking the user to open google maps ?

Thanks in advance

Pedro Caldeira

Active Member
Licensed User
Longtime User
FLP is a mature library/SDK. It is probably a mistake in your code.
The strangest thing is when I switch to google maps, press my location icon and then switch back to my App, the coordinates "unfreeze" and return the actual ones. Also "Unfreezes" when I show a map (mapfragment method) in the App, and then retrieve the data from FLP.
Last edited:
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
my Service (LocationService) with FLP
Anything wrong with it, that may be causing the reported issue ?

I call it from several parts in the APP using :

Private sACLALatitude As String =
Private sACLALongitude As String = LocationService.GeoLocal.lon

GeoData is a custom type
Type GeoData(lat As String, lon As String, date As String)

#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    Public flp As FusedLocationProvider
    Public GeoLocal As GeoData
    Private LastLocation As Location
    Private inactivity_overpass As Boolean = False
End Sub

Sub Service_Create
End Sub

Sub flp_ConnectionSuccess
    'Log("Connected to location provider")
'    Dim rs As ResumableSub = CallSub(Starter, "CheckLocationSettingStatus")
    Dim rs As ResumableSub = CheckLocationSettingStatus
    Wait For (rs) Complete (SettingsResult As LocationSettingsResult)
    Dim sc As StatusCodes
    If (SettingsResult.GetLocationSettingsStatus.GetStatusCode = sc.SUCCESS) Then
    End If
End Sub

Sub flp_ConnectionFailed(ConnectionResult1 As Int)
    'Log("Failed to connect to location provider")
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub

Sub CheckLocationSettingStatus As ResumableSub
    Dim f As LocationSettingsRequestBuilder
    Wait For flp_LocationSettingsChecked(LocationSettingsResult1 As LocationSettingsResult)
    Return LocationSettingsResult1
End Sub

Public Sub StartLocationUpdates
End Sub

Private Sub flp_LocationChanged (Location1 As Location)
    If (Utils.NNE(Location1.Latitude) And Utils.NNE(Location1.Longitude)) Then
    End If
End Sub

Private Sub CreateLocationRequest As LocationRequest
    Dim lr As LocationRequest
    Return lr
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy
End Sub

Sub UpdateUI(Location1 As Location)
    GeoLocal = Types.setGeoDataDT("-", "-", "")
    If Not(Starter.APP_RESET_INSTALL) Then
        DateTime.TimeFormat = "HH:mm:ss"
        DateTime.DateFormat = "yyyy-MM-dd"
        Dim Data As String  = $"$date{DateTime.Now} $time{DateTime.Now}"$ ' ${LastLocation.Time}"$
        Dim lat As String = "-"
        Dim lon As String = "-"
            Dim lat As String = $"${Utils.IfNullOrEmpty(Location1.Latitude, "")}"$
            Dim lon As String = $"${Utils.IfNullOrEmpty(Location1.Longitude, "")}"$
            Dim lat As String = ""
            Dim lon As String = ""
        End Try
        GeoLocal = Types.setGeoDataDT(lat, lon, Data)
    End If
'    ToastMessageShow($"LOCL:: Latitude: ${Utils.IfNullOrEmpty(Location1.Latitude, "")}, Logitude: ${Utils.IfNullOrEmpty(Location1.Longitude, "")}"$, False)
End Sub
Last edited:
Upvote 0