B4J Question Geolocation only works locally

Rob White

Member
Licensed User
Hi all,

I have an ABMaterial server application running on Win 10.
When I execute a GeoLocate using code below I only see my location when using an address like Localhost:50000/....
GeoLocate:
Sub butgotoloc_clicked(Tar As String)
    Dim gm1 As ABMGoogleMap = page.Component("gmap")
    Log("About To call GeoLocate")
    gm1.GeoLocate            ' NOTE this fires gmap_CurrentLocation where You can call SetLocation()
End Sub

Yes I have implemented gmap_CurrentLocation it looks like this:-
B4X:
Sub gmap_CurrentLocation(Latitude As Double, Longitude As Double)
    Log($"gmap_CurrentLocation triggered Lat = ${Latitude}, Lon = ${Longitude}"$)
    Dim gm1 As ABMGoogleMap = page.Component("gmap")
    gm1.SetLocation(Latitude, Longitude)
    gm1.Zoom = 15
    gm1.Refresh ' IMPORTANT
End Sub

When first executed I am asked for permission to send location.

As I said above any address other than localhost will not work. There is no error messages that I can find in logs.
Using my phone does not work even when location is set to "Allowed only while in use" for Edge or Google browser.
In this case the app is running off an Rasberry Pi.

I am assuming some kind of a port issue. Does anyone know what needs to be set.
 
Top