Sub Process_Globals
Dim GPS1 As GPS
End Sub
Sub Globals
Dim Txt_Site_Lat As EditText
Dim Txt_Site_Long As EditText
Dim Btn_Site_GetLoc As Button
Dim Result As Int
Dim CurrentLat As String
Dim CurrentLong As String
End Sub
Sub Btn_Site_GetLoc_Click
If GPS1.IsInitialized = False Then
GPS1.Initialize("")
End If
If GPS1.GPSEnabled = False Then
Result = Msgbox2("The GPS needs to be turned on in the phone settings to use this function.","Activate GPS?","Open GPS settings","","Don't open GPS settings",Null)
If Result = DialogResponse.POSITIVE Then
StartActivity(GPS1.LocationSettingsIntent)
Return
Else If Result = DialogResponse.NEGATIVE Then
Return
End If
Else If GPS1.GPSEnabled = True Then
GPS1.Start(0,0)
Log("GPS Activated")
Msgbox("GPS Activated","")
Txt_Site_Lat.Text = "Searching"
Txt_Site_Long.Text = "Searching"
End If
End Sub
Sub GPS_LocationChanged(Location1 As Location)
Msgbox("Congrats! Your GPS is working!","")
Msgbox("Latitude is " & Location1.Latitude,"")
Msgbox("Longitude is " & Location1.Longitude,"")
CurrentLat = Location1.Latitude
CurrentLong = Location1.Longitude
Txt_Site_Lat.Text = Location1.Latitude
Txt_Site_Long.Text = Location1.Longitude
GPS1.Stop
End Sub