I have written an app that uses NMEA data, provided by NmeaListener. This app works perfectly on following devices:
- Asus Nexus 7, Android 4.1.1
- Samsung Nexus S, Android 4.1.2
- SonyEricsson Xperia Mini, Android 2.3.4
- SonyEricsson Xperia X10 Mini, Android 2.1.1
On all those devices, the onNmeaReceived() is called with no problem.
But on the low cost device
- Huawei/Vodafone 858, Android 2.2.2
onNmeaReceived() is not called at all. At least onLocationChanged() is called on all devices, including the Huawei. But I don’t need the location, I need the NMEA data.
So, what can I do?
Thanks in advance for your help!
public class Main extends Activity implements NmeaListener, LocationListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager location = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
location.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1l, 1l, this);
location.addNmeaListener(this);
}
@Override
public void onNmeaReceived(long timestamp, String nmea) {
}
@Override
public void onLocationChanged(Location arg0) {
}
@Override
public void onProviderDisabled(String arg0) {
}
@Override
public void onProviderEnabled(String arg0) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}
This seems to be a known issue if you look at this thread:
Issue 7321: NmeaListener does not receive nmea sentences
if this is affecting you there is probably no other solution than generating fake NMEA from the location updates, at least on the affected phones.
[Edit]
From your comment it seems that you assume you need NmeaListener in order to display info like signal strengths and Satellites, but I think you can do this without NmeaListener, just look at the answers to:
How to measure GPS signal strength on Android?