On my HTC phone, the GPS does NOT create the GLL sentence, however, the GGA (more comprehensive sentence) is, so, while capturing I'm creating the GLL starting from the GGA NMEA sentence as follows:
PrivateFunction GLLfromGGA(ByVal _l AsString) AsString
' $GPGLL,4916.45,N,12311.12,W,225444,A
' $GPGGA,143346.0,2617.198217,N,08012.222742,W,1,08,1.0,-23.5,M,,,,*04
Dim w() AsString = _l.Split(","c) Dim GLL AsString = String.Format("$GPGLL,{0},{1},{2},{3},{4},{5}", w(2), w(3), w(4), w(5), w(1), "A") ReturnString.Format("{0}*{1}", GLL, GetNMEAchecksum(GLL)) EndFunction
' Calculates the checksum for a sentence
PublicFunction GetNMEAchecksum(ByVal sentence AsString) AsString
' Loop through all chars to get a checksum
Dim Character AsChar
Dim Checksum AsInteger
ForEach Character In sentence
SelectCase Character
Case"$"c
' Ignore the dollar sign
Case"*"c
' Stop processing before the asterisk
ExitFor
CaseElse
' Is this the first value for the checksum?
If Checksum = 0 Then
' Yes. Set the checksum to the value
Checksum = Convert.ToByte(Character)
Else
' No. XOR the checksum with this character's value
Checksum = Checksum
Xor Convert.ToByte(Character)
EndIf
EndSelect
Next
' Return the checksum formatted as a two-character hexadecimal
Return Checksum.ToString("X2") EndFunction