Here is the code, but I have take it from documentation od Basic4Android.
Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: GPS
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim lblLon As Label
Dim lblLat As Label
Dim lblSpeed As Label
Dim lblSatellites As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub
Sub Activity_Resume
If Starter.GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
CallSub(Starter, "StopGPS")
End Sub
Public Sub GpsStatus (Satellites As List)
Dim sb As StringBuilder
sb.Initialize
sb.Append("Satellites:").Append(CRLF)
For i = 0 To Satellites.Size - 1
Dim Satellite As GPSSatellite = Satellites.Get(i)
sb.Append(CRLF).Append(Satellite.Prn).Append($" $1.2{Satellite.Snr}"$).Append(" ").Append(Satellite.UsedInFix)
sb.Append(" ").Append($" $1.2{Satellite.Azimuth}"$).Append($" $1.2{Satellite.Elevation}"$)
Next
lblSatellites.Text = sb.ToString
End Sub
Public Sub LocationChanged(Location1 As Location)
lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
lblSpeed.Text = $"Speed = $1.2{Location1.Speed} m/s "$
End Sub