Hi out there,
I am bashing around with android localization and already figured out how to receive NMEA data. Unfortunately, the results seem to be very chaotic. I do only need the GPRMC sentence but get GPGGA, GPVTG etc. returned. Is there any way to control the onNmeaReceived() function?
public class TrackingService extends Service {
private Intent broadcastIntent = new Intent("com.example.locationlogger.TestBroadcastReceiver");
private LocationManager lm;
private LocationListener ll = new LocationListener(){
//sample listener...
};
GpsStatus.NmeaListener nl = new GpsStatus.NmeaListener() {
@Override
public void onNmeaReceived(long timestamp, String nmea) {
/*
* Broadcast a message..
*/
broadcastIntent.putExtra("TESTVAR", "Received some nmea strings: " + nmea);
sendBroadcast(broadcastIntent);
}
};
@Override
public void onCreate() {
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
}
@Override
public void onStart(Intent intent, int startId) {
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval * 1000, 0, ll);
lm.addNmeaListener(nl);
}
}