我是android新手,我通过gps获取位置,我还在我们的代码中获取卫星号码,但我想获取用于获取位置的特定卫星名称或号码。我有很多谷歌,但没有得到适当的解决方案。
我的问题是:-1. It is possible to get a particular satellite name or number ? if yes please help me how to find it ?
提前致谢
locationManager.getGpsStatus(null).getSatellites() http://developer.android.com/reference/android/location/GpsStatus.html#getSatellites%28%29(调用者可以传入一个 GpsStatus 对象来设置最新的状态信息,或者传递 null 来创建一个新的 GpsStatus 对象。)
返回一个数组GPS卫星 http://developer.android.com/reference/android/location/GpsSatellite.html对象,代表 GPS 引擎的当前状态。
locationManager.getGpsStatus(null).getSatellites().getPrn() http://developer.android.com/reference/android/location/GpsSatellite.html#getPrn%28%29返回卫星的 PRN(伪随机数)。
获取最大卫星数 () http://developer.android.com/reference/android/location/GpsStatus.html#getMaxSatellites%28%29返回 getSatellites() 可返回的卫星列表中的卫星的最大数量。
Code :
public class SatellitesInfoActivity extends Activity implements GpsStatus.Listener {
LocationManager locationManager = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.addGpsStatusListener(this);
}
@Override
public void onGpsStatusChanged(int) {
GpsStatus gpsStatus = locationManager.getGpsStatus(null);
if(gpsStatus != null) {
Iterable<GpsSatellite>satellites = gpsStatus.getSatellites();
Iterator<GpsSatellite>sat = satellites.iterator();
String lSatellites = null;
int i = 0;
while (sat.hasNext()) {
GpsSatellite satellite = sat.next();
lSatellites = "Satellite" + (i++) + ": "
+ satellite.getPrn() + ","
+ satellite.usedInFix() + ","
+ satellite.getSnr() + ","
+ satellite.getAzimuth() + ","
+ satellite.getElevation()+ "\n\n";
Log.d("SATELLITE",lSatellites);
}
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)