#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: GPS
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#End Region
Sub Process_Globals
Public GPS1 As GPS
Public locationw As Location
End Sub
Sub Globals
Dim lblLon As Label
Dim lblLat As Label
Dim lblSpeed As Label
Dim lblSatellites As Label
Dim precis,Vel,bearing,alt As Float
Private lblprec As Label
Private lblbearing As Label
Private lblalt As Label
Private lblaccval As Label
Private lblspeedval As Label
Dim a As Int
Private btntest As Button
Private Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
GPS1.Initialize("GPS")
End If
Activity.LoadLayout("1")
End Sub
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.Text = "Lat = " & location1.ConvertToSeconds(location1.Latitude)
lblLon.Text = "Lon = " & location1.ConvertToseconds(location1.Longitude)
Vel=Round(location1.Speed*3600/1000)
lblSpeed.Text = "Speed = " & Round2(Vel,1)
precis=location1.accuracy
lblprec.Text= "Prec = " & Round2(precis,1)
bearing=location1.Bearing
lblbearing.Text= "Bear = " & Round2(bearing,1)
alt=location1.Altitude
lblalt.Text= "Alt = " & Round2(alt,1)
If location1.SpeedValid=True Then
lblspeedval.text="SI"
Else
lblspeedval.text="NO"
End If
If location1.AccuracyValid=True Then
lblaccval.text="SI"
Else
lblaccval.text="NO"
End If
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
ToastMessageShow("GPS device enabled = " & Enabled, True)
End Sub
Sub GPS_GpsStatus (Satellites As List)
lblSatellites.Text = "Satellites:" & CRLF
For i = 0 To Satellites.Size - 1
Dim Satellite As GPSSatellite
Satellite = Satellites.Get(i)
If Satellite.UsedInFix=True Then
a=a+1
End If
Next
lblSatellites.Text = lblSatellites.Text & CRLF & a
a=0
End Sub
Sub btntest_Click
locationw.Initialize
Label1.Text=locationw.Latitude
End Sub