小编Sor*_*ean的帖子

无法获得卫星计数Android

通过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)

java gps android

6
推荐指数
1
解决办法
6596
查看次数

标签 统计

android ×1

gps ×1

java ×1