Sub Process_Globals
Dim GPS1 As GPS
End Sub
Sub Globals
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
Private scale As MapScaleView
Dim lblLon As Double
Dim lblLat As Double
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("CreateBox")
scale.Initialize("")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
GPS1.Initialize("CreateBox")
Sub Activity_Resume
If GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
GPS1.Start(0, 0) 'Listen to GPS with no filters.
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
GPS1.Stop
End Sub
Sub GPS_LocationChanged (Location1 As Location)
lblLat = Location1.Latitude
lblLon = Location1.Longitude
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
ToastMessageShow("GPS device enabled = " & Enabled, True)
End Sub
Sub MapFragment1_Ready
Log($"map_Ready()"$)
gmap = MapFragment1.GetMap
Dim cp1 As CameraPosition
cp1.Initialize(lblLat, lblLon, 15) ' Use own location LAT LON
gmap.AnimateCamera(cp1)
Log(lblLat)
Log(lblLon)