From 67e4dd8a6b8a1497ee16c9f8f0b22b93d5559fe1 Mon Sep 17 00:00:00 2001 From: Sean Barbeau Date: Fri, 6 Sep 2019 20:15:35 -0400 Subject: [PATCH] Remove new line characters from NMEA sentences before logging Some devices such as the Samsung Galaxy S8+ (SM-G955U) add a new line character at the end of the NMEA sentence, which breaks logging by pushing the timestamp for the NMEA sentence to the following line --- .../google/android/apps/location/gps/gnsslogger/FileLogger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java index 7be31c2..0022532 100644 --- a/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java +++ b/GNSSLogger/app/src/main/java/com/google/android/apps/location/gps/gnsslogger/FileLogger.java @@ -332,7 +332,7 @@ public void onNmeaReceived(long timestamp, String s) { if (mFileWriter == null) { return; } - String nmeaStream = String.format(Locale.US, "NMEA,%s,%d", s, timestamp); + String nmeaStream = String.format(Locale.US, "NMEA,%s,%d", s.trim(), timestamp); try { mFileWriter.write(nmeaStream); mFileWriter.newLine();