通过adb使用geo fix命令时,我似乎无法获得卫星计数.
地理修复帮助读取:
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)
Run Code Online (Sandbox Code Playgroud)
我使用以下命令设置地理位置以触发OnLocationChanged执行:
geo fix -106.1221 52.1311 514 5
Run Code Online (Sandbox Code Playgroud)
在OnlocationChanged中:
Location newestloc = loc;
Bundle sats = newestloc.getExtras();
int satcount = 0;
satcount = sats.getInt("satellites");
Run Code Online (Sandbox Code Playgroud)
但是每当我打电话给satcount时,我总是得到0.是否通过geo fix传递的卫星数量不计算在内?
有没有其他方法可以获得手机GPS当前看到的号码卫星?
编辑:我也尝试了以下代码:
GpsStatus gpsstat = mlocManager.getGpsStatus(null);
Iterable sats = …Run Code Online (Sandbox Code Playgroud)