Private show_map As MapFragment
Private shared As String
Private gmap As GoogleMap
Private panel_map As Panel
show_map.Initialize("show_map", panel_map)
'Log("here")
Do Until show_map.GetMap.IsInitialized
Sleep(300)
Loop
Log("Isinit=> " & show_map.GetMap.IsInitialized)
If show_map.GetMap.IsInitialized Then
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_COARSE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
gmap = show_map.GetMap
gmap.MyLocationEnabled = True
End If
'Log("Status_Gps: " & Starter.gpsStarted)
If show_map.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Google Play services not available.", True)
End If
Log("Gmap isinit:> " & gmap.IsInitialized)
If gmap.IsInitialized Then
If File.ExternalWritable = False Then
Msgbox("No rights to write"," ")
Return
Else
shared = Starter.rp.GetSafeDirDefaultExternal("GPS_Location")
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
If Result Then SaveStringExample
End If
'--Method
Dim pl As Polyline = gmap.AddPolyline
Dim lat_lng As String
Dim lat, lng As Double
Dim Points As List
Points.Initialize
CallSub(Starter, "StopGPS")
For Each k As Int = 0 In Starter.gmaps.Keys 'an array
lat_lng = Starter.gmaps.GetValueAt(k)
lat = lat_lng.SubString2(0, lat_lng.IndexOf(","))
lng = lat_lng.SubString2(lat_lng.IndexOf(",") + 1, lat_lng.Length)' - 1)
'Log("Lat: " & lat & " Longi: " & lng)
Dim ll As LatLng
ll.Initialize(lat, lng)
Log(ll)
Points.add(ll)
Next
pl.Points = Points
pl.Color= Colors.Blue
pl.ZIndex=3
'pl.Visibile = True
gmap.AddMarker(lat,lng, "hello")
Dim cp As CameraPosition
cp.Initialize(lat, lng, gmap.CameraPosition.Zoom)
gmap.AnimateCamera(cp)
Else
Log("Gmap not initialize llll")
End If