0

I would like to know the number of satelites in my GPS app. But somehow the onGpsStatusChanged func never gets called.

Any ideas?

private class MyGpsStatusListener implements android.location.GpsStatus.Listener
{

    @Override
    public void onGpsStatusChanged(int arg0) {

        String strGpsStats = "";

        GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
        if(gpsStatus != null) {
            Iterable<GpsSatellite>satellites = gpsStatus.getSatellites();
            Iterator<GpsSatellite>sat = satellites.iterator();
            int i=0;
            while (sat.hasNext()) {
                GpsSatellite satellite = sat.next();

                strGpsStats+= (i++) + ": " + satellite.getPrn() + "," + satellite.usedInFix() + "," + satellite.getSnr() + "," + satellite.getAzimuth() + "," + satellite.getElevation()+ "\n\n";
            }

            Toast.makeText(getBaseContext(), strGpsStats, Toast.LENGTH_LONG).show();
            Log.i(T, "GPS STATUS HAS CHANGED:" + strGpsStats);
        }
    }

}
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222
  • 1
    check common missings like...permissions in manifest,update criteria..post fullcode if possible. – nayab Feb 24 '13 at 17:44
  • Did you start requesting updates? – Brent Hronik Feb 24 '13 at 18:19
  • Check out this answer to make sure you have the GpsStatus.Listener properly implemented and registered: https://stackoverflow.com/questions/14222152/androids-onstatuschanged-not-working/14261618#14261618 – Sean Barbeau Mar 01 '13 at 17:30

0 Answers0