Tuesday, September 6, 2011

[android-developers] Re: Displaying NMEA sentences

Hi,

This is a known bug on some devices, eg Nexus One & Motorola Xoom see
http://code.google.com/p/android/issues/detail?id=15500

I get around it by using external bluetooth GPS devices.

In 'GPS Test' they might be reverse engineering the 'Location &
related classes' details back into NMEA strings, but you would have to
ask them...

Regards

On Sep 6, 9:40 pm, WolpTec <n...@wolptec.com> wrote:
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment