Android Question Can you get raw NMEA sentences from GPS receiver?

Troberg

Well-Known Member
Licensed User
Longtime User
Something like this:

B4X:
Sub Class_Globals
    Private MyGPS As GPS
End Sub

Public Sub Initialize
    MyGPS.Initialize("MyGPS")
    If MyGPS.GPSEnabled = False Then
        StartActivity(MyGPS.LocationSettingsIntent) 'Will open the relevant settings screen.
    Else
        MyGPS.Start(0, 0)
    End If
End Sub

Public Sub Destroy()
    MyGPS.Stop
End Sub

Private Sub MyGPS_NMEA (TimeStamp As Long, Sentence As String)
   Log(Sentence)
End Sub

Edit: Note: Destroy is not called by default, you'll have to call it manually to dispose of the class when you don't need it anymore.
 
Upvote 0
Top