开发者

Android Getting the GPSStatus always return nothing, why?

my code is:

android.location.GpsStatus.Listener gpsstatusListenerGps = new android.location.GpsStatus.Listener() { public void onGpsStatusChanged(int event) {

    GpsStatus gpsStatus             = lm.getGpsStatus(null);                    

    switch (event) {
            case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                locationResult.gotSatellites(gpsStatus);
                Log.e("gpsStatus", "gpsStatus");

                lm.removeGpsStatusListener(gpsstatusListenerGps);

            for (GpsSatellite sat:lm.getGpsStatus(null).getSatellites()) {
                Log.e("STATUS", "gpsx.GpsStatus.Sat.fixed: " + sat.usedInFix());
            }

                break;
            case GpsStatus.GPS_EVENT_FIRST_FIX:
                locationResult.gotSatellites(gpsStatus);
            Log.e("FIX", "gpsx.fixed.");

            lm.removeGpsStatusListener(gpsstatusListenerGps);


            for (GpsSatellite sat:lm.getGpsStatus(null)开发者_开发技巧.getSatellites()) {
                Log.e("FIXX", "gpsx.GpsStatus.Sat.fixed: " + sat.usedInFix());
            }


                break;
    }

    }
};

... Log.e("sat.hasNext()",""+sat.hasNext());

        while (sat.hasNext()){
           GpsSatellite oSat = (GpsSatellite) sat.next();
           Log.e("gps",""+oSat.getSnr());   
       }

sat.hasNext is always false.

i always getting nullstring, so i cant get gpsstatuses, why?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜