iOS Question Latitude and Longitude of my Position

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
hi,
i'm using googleMaps in my app and i need to konw my position: latitude and longitude.

Here is my code:
B4X:
    gmap.Initialize("gmap", ApiKey)
    lisPNmap.AddView(gmap, 0, 0, 100%X, 100%y)
    gmap.MapType = gmap.MAP_TYPE_TERRAIN
    gmap.GetUiSettings.CompassEnabled = True
    gmap.GetUiSettings.MyLocationButtonEnabled = True
    gmap.MyLocationEnabled = True

    Dim mylat As Double
    Dim mylon As Double
 
    mylat=gmap.MyLocation.Latitude
    mylon=gmap.MyLocation.Longitude
    Log("MyLat: " & mylat)
    Log("MyLon: " & mylon)

Log result is:

MyLat: 0
MyLon: 0

but on google map the position is correct....(blue button near rome):
upload_2015-7-20_14-4-43.png

What should i do?
thx
Marco
 
Last edited:

Marco Maria Vilucchi

Active Member
Licensed User
Longtime User
but MyLocationEnabled works...

B4X:
gmap.Initialize("gmap", ApiKey)
    lisPNmap.AddView(gmap, 0, 0, 100%X, 100%y)
    gmap.MapType = gmap.MAP_TYPE_TERRAIN
    gmap.GetUiSettings.CompassEnabled = True
    gmap.GetUiSettings.MyLocationButtonEnabled = True          <============= WORKS
    gmap.MyLocationEnabled = True           <============= WORKS

    Dim mylat As Double
    Dim mylon As Double
    mylat=gmap.MyLocation.Latitude
    mylon=gmap.MyLocation.Longitude
    Log("MyLat: " & mylat)                       <============= DOESN'T WORK
    Log("MyLon: " & mylon)                      <============= DOESN'T WORK

Why?
 
Upvote 0
Top