I want to display raw nmea sentences. In order to do so I wrote some
code (excerpts below). The problem is that it doesn't work in most
cases. It doesn't work on the emulator using versions 2.1, 2.2 or 2.3,
neither on my real existing Samsung Galaxy S5660, running Android 2.2,
but it *does run* on a friends Samsung Nexus with version 2.3, as he
told me.
Actually the onNmeaReceived() handler is never called, though
onLocationChanged() *is* beeing called when I send a couple of nmea
sentences to the emulator via telnet commands. There is an app called
"GPS Test" which is surely based on raw nmea, and this app works on my
phone device. Im wondering what they do different than I do? Any ideas?
TIA,
Hans
private GpsStatus.NmeaListener nmeaListener = new GpsStatus.NmeaListener() {
public void onNmeaReceived(long timestamp, String nmea) {
UpdateDisplay(nmea);
}
};
private void UpdateDisplay(String str) {
logBox.AddLine(str);
}
private final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location l) {
UpdateDisplay("Pos: " + Double.toString(l.getLatitude()) + "
" +
Double.toString(l.getLongitude()));
}
public void onProviderDisabled(String provider){}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle
extras) {}
};
public void InitGps() {
locMan = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
try {
locMan.addNmeaListener(nmeaListener);
UpdateDisplay("Started ...");
}
catch(Exception ex) {
ex.printStackTrace();
}
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en