Alexander Stolte Expert Licensed User Longtime User Apr 16, 2018 #1 Hey, I can not determine the current position. How does work in B4I? My current code: B4X: Private Sub AddMap gmap.Initialize("gmap", Main.API_KEY_2) pnl_gmap.AddView(gmap, 0, 0, 100%X, 100%y) 'gmap.MapType = gmap.MAP_TYPE_TERRAIN gmap.GetUiSettings.CompassEnabled = False gmap.GetUiSettings.MyLocationButtonEnabled = False gmap.MyLocationEnabled = True Msgbox(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude ,"title") End Sub the output are "0"
Hey, I can not determine the current position. How does work in B4I? My current code: B4X: Private Sub AddMap gmap.Initialize("gmap", Main.API_KEY_2) pnl_gmap.AddView(gmap, 0, 0, 100%X, 100%y) 'gmap.MapType = gmap.MAP_TYPE_TERRAIN gmap.GetUiSettings.CompassEnabled = False gmap.GetUiSettings.MyLocationButtonEnabled = False gmap.MyLocationEnabled = True Msgbox(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude ,"title") End Sub the output are "0"
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2018 #2 You've just enabled the location tracking, don't expect it to be immediately available. B4X: Private Sub AddMap gmap.Initialize("gmap", Main.API_KEY_2) pnl_gmap.AddView(gmap, 0, 0, 100%X, 100%y) 'gmap.MapType = gmap.MAP_TYPE_TERRAIN gmap.GetUiSettings.CompassEnabled = False gmap.GetUiSettings.MyLocationButtonEnabled = False gmap.MyLocationEnabled = True Do Until gmap.MyLocation.IsInitialized Sleep(1000) Loop Log(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude) Msgbox(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude ,"title") End Sub Upvote 0
You've just enabled the location tracking, don't expect it to be immediately available. B4X: Private Sub AddMap gmap.Initialize("gmap", Main.API_KEY_2) pnl_gmap.AddView(gmap, 0, 0, 100%X, 100%y) 'gmap.MapType = gmap.MAP_TYPE_TERRAIN gmap.GetUiSettings.CompassEnabled = False gmap.GetUiSettings.MyLocationButtonEnabled = False gmap.MyLocationEnabled = True Do Until gmap.MyLocation.IsInitialized Sleep(1000) Loop Log(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude) Msgbox(gmap.MyLocation.Latitude & " und : " & gmap.MyLocation.Longitude ,"title") End Sub