雖然使用地理修復命令,但通過adb我似乎無法獲得衛星數。不能得到衛星數Android
的地理修復幫助寫着:
geo fix <longitude> <latitude> [<altitude> [<satellites>]]
allows you to send a simple GPS fix to the emulated system
The parameters are:
<longitude> longitude, in decimal degrees
<latitude> latitude, in decimal degrees
<altitude> optional altitude in meters
<satellites> number of satellites being tracked (1-12)
我用下面的命令來設置地理位置來觸發OnLocationChanged執行:
geo fix -106.1221 52.1311 514 5
在OnlocationChanged:
Location newestloc = loc;
Bundle sats = newestloc.getExtras();
int satcount = 0;
satcount = sats.getInt("satellites");
然而每當我打電話給satcount時,我總是得到0.是衛星的數量是pa通過未計算的地理修復?
有沒有其他的方法來獲取手機的GPS當前所看到的號碼衛星?
編輯: 我也曾嘗試下面的代碼,以及:
GpsStatus gpsstat = mlocManager.getGpsStatus(null);
Iterable sats = gpsstat.getSatellites();
Iterator satI = sats.iterator();
int count = 0;
while(satI.hasNext()){
GpsSatellite gpssatellite = (GpsSatellite) satI.next();
if (gpssatellite.usedInFix()){
count++;
}
}
這項工作應在最低限度返回1,每次我得到一個固定的時間,但它從來沒有從0
我也試過。 (Iterator sats =(Iterator )mlocManager.getGpsStatus(null).getSatellites();''sats.hasNext();){' 'count ++ ;'' sats.next();'' }'' = satcount計數;' 以上不工作,要麼,還是返回0 –
Sorean
2011-03-04 18:45:32
我用三星Galaxy S.測試,但,這是一個側請注意,正如我所提到的,我正試圖用adb完成計數。我的意思是它也會轉移到手機上,但如果應用程序在adb中提取它,它應該轉移到手機上。該應用程序的工作原理是,它獲取GPS定位並將其顯示在屏幕上(測試過),但不顯示它檢測到的衛星數量。 – Sorean 2011-03-07 16:20:01
你可以檢查adb日誌嗎? – 2011-03-08 17:32:39