#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Marca As Marker
Public UltimaPosicion As LatLng
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private MapFragment1 As MapFragment
Private cmdAceptar As Button
Private gmap As GoogleMap
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("LayoutMapa")
Wait For MapFragment1_Ready
gmap = MapFragment1.GetMap
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
gmap.MyLocationEnabled = True
Do While gmap.MyLocation.IsInitialized = False
Log("Location not initialized... Sleep a while...")
Sleep(250)
Loop
If gmap.MyLocation.IsInitialized Then
Dim CameraPosition1 As CameraPosition 'CameraPosition1.Initialize2(gmap.MyLocation.Latitude, gmap.MyLocation.Longitude, gmap.CameraPosition.Zoom, 0, 0)
CameraPosition1.Initialize(gmap.MyLocation.Latitude,gmap.MyLocation.Longitude, 17)
gmap.moveCamera(CameraPosition1)
End If
Else
Log("Permiso no concedido")
Activity.Finish
End If
Activity.Title = "Seleccione lugar"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub cmdAceptar_Click
Activity.Finish
End Sub
Private Sub MapFragment1_Click (Point As LatLng)
cmdAceptar.Text=Point.Latitude & " / " & Point.Longitude
UltimaPosicion = Point
gmap.Clear
Marca = gmap.AddMarker(Point.Latitude,Point.Longitude,"Punto" )
End Sub