我是新android系统中,我通过GPS获得的位置,我也越来越卫星数量在我们的code,但我希望得到具体的卫星名称或用于获取位置号码。我有谷歌那么多,但没有得到有关这妥善解决。
I am new in android, I am getting location through gps, I am also getting satellite number in our code but I want to get specific satellite name or number which is used to get the location. I have google so much but not getting proper solution regarding this.
我的问题是: -
1。它有可能获得一个特定的卫星的名称或号码?如果有,请帮我怎么找呢?
My Question is:-
1. It is possible to get a particular satellite name or number ? if yes please help me how to find it ?
在此先感谢
的 locationManager.getGpsStatus(空).getSatellites()(主叫方既可以传递一个GpsStatus对象设置为最新状态信息,或传递null以创建一个新的GpsStatus对象。)
locationManager.getGpsStatus(null).getSatellites() (The caller may either pass in a GpsStatus object to set with the latest status information, or pass null to create a new GpsStatus object.)
返回 GpsSatellite阵列对象,从而重新present的GPS引擎的当前状态。
Returns an array of GpsSatellite objects, which represent the current state of the GPS engine.
locationManager.getGpsStatus(空).getSatellites() .getPrn() 返回PRN(伪随机数)的卫星。
locationManager.getGpsStatus(null).getSatellites().getPrn() Returns the PRN (pseudo-random number) for the satellite.
getMaxSatellites() 返回卫星的,可以是在可由getSatellites返回的卫星列表的最大数量()。
getMaxSatellites () Returns the maximum number of satellites that can be in the satellite list that can be returned by 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);
}
}
}
}
上一篇:可Android的工作室用于创建单位插件兼容的JAR出库的项目?插件、工作室、单位、项目
下一篇:为什么玻璃/ GDK基础VoiceListener只有在XE16赶上VoiceCommand一次?玻璃、基础、GDK、VoiceCommand