Search code examples
javaandroidgpsandroid-gpsandroid-developer-api

Source of NMEA sentences in Android LocationManager


I have a Note2 that stopped providing proper GPS location information due to the WNRO.

I can see from logging NMEA sentences that a wrong date is delivered, and furthermore that the satfix is lost every couple of seconds/minutes. The Note2 is using a binary proprietary driver (gpsd) by Broadcom to interact with the chip. To see if this can be fixed (as I did on some other devices), I need to know what is responsible in Android to output NMEA sentences.

Are NMEA sentences always output directly by the GPS chip and the respective drivers into a named pipe, or are NMEA sentences generated by the LocationManager-framework/API?


Solution

  • NMEA sentence are generated by the GPS chip and, for example,

    through the android.location.GpsStatus.NmeaListener

    Used for receiving NMEA sentences from the GPS.

    By implementing this interface and calling

    LocationManager#addNmeaListener to receive NMEA data from the GPS engine.

    https://developer.android.com/reference/android/location/GpsStatus.NmeaListener

    Both quotes indicate that the NMEA sentences are not being generated by the Android Location API.

    Note: I referenced a deprecated interface (GpsStatus.NmeaListener) since Note2 is an old device and most probably is using it.