Reputation: 13
I have an application on android currently receiving NMEA data GPGSA with the method:
locationManager.addNmeaListener (new GpsStatus.NmeaListener () {
@ Override
public void onNmeaReceived (long timestamp, nmea String) {
ts = timestamp;
nm = nmea;
}});
Any chance that instead of receiving data at the receiving GPGSA GPRMC.
I use a GPS Desire HD for testing.
Upvotes: 1
Views: 1664
Reputation: 3794
When you use addNmeaListener you will receive all GPS sentences that the phone provides (which in some cases is none at all). However GPGSA contains only satellite DOP information so if you're receiving that you'll almost certainly be getting GPRMC as well.
I suspect your problem is you're moving all sentences received to a global variable and GPGSA happens to be the last one received at the time you're reading the buffer. You'll want something like this:
if (nmea.substring(0,6).equals("$GPRMC")) {
ts = timestamp;
nm = nmea;
}
Upvotes: 2