本文整理匯總了Java中android.location.GpsSatellite.getAzimuth方法的典型用法代碼示例。如果您正苦於以下問題:Java GpsSatellite.getAzimuth方法的具體用法?Java GpsSatellite.getAzimuth怎麽用?Java GpsSatellite.getAzimuth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.location.GpsSatellite
的用法示例。
在下文中一共展示了GpsSatellite.getAzimuth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateStatus
import android.location.GpsSatellite; //導入方法依賴的package包/類
private void updateStatus(GpsStatus status) {
setStarted(true);
Iterator<GpsSatellite> satellites = status.getSatellites().iterator();
if (mPrns == null) {
int length = status.getMaxSatellites();
mPrns = new int[length];
mSnrs = new float[length];
mSvElevations = new float[length];
mSvAzimuths = new float[length];
}
mSvCount = 0;
while (satellites.hasNext()) {
GpsSatellite satellite = satellites.next();
int prn = satellite.getPrn();
mPrns[mSvCount] = prn;
mSnrs[mSvCount] = satellite.getSnr();
mSvElevations[mSvCount] = satellite.getElevation();
mSvAzimuths[mSvCount] = satellite.getAzimuth();
mSvCount++;
}
mAdapter.notifyDataSetChanged();
}
示例2: setSats
import android.location.GpsSatellite; //導入方法依賴的package包/類
public void setSats(GpsStatus status) {
Iterator<GpsSatellite> satellites = status.getSatellites().iterator();
if (mSnrs == null) {
int length = status.getMaxSatellites();
mSnrs = new float[length];
mElevs = new float[length];
mAzims = new float[length];
}
mSvCount = 0;
while (satellites.hasNext()) {
GpsSatellite satellite = satellites.next();
mSnrs[mSvCount] = satellite.getSnr();
mElevs[mSvCount] = satellite.getElevation();
mAzims[mSvCount] = satellite.getAzimuth();
mSvCount++;
}
mStarted = true;
invalidate();
}
示例3: onGpsStatusChanged
import android.location.GpsSatellite; //導入方法依賴的package包/類
public void onGpsStatusChanged(int event) {
switch (event) {
case GpsStatus.GPS_EVENT_FIRST_FIX:
Log.i(TAG, "第一次定位");
intent.putExtra("GPS_info", "第一次定位");
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
// 獲取當前狀態
gs = locationManager.getGpsStatus(null);
int maxSatellites = gs.getMaxSatellites();// 獲取衛星顆數的默認最大值
Iterator<GpsSatellite> iters = gs.getSatellites().iterator();
// 創建一個迭代器保存所有衛星
int count = 0;
String info = "";
while (iters.hasNext() && count <= maxSatellites) {
GpsSatellite s = iters.next();
count++;
info += count + "\t:" + s.getPrn() + "\t信噪比:" + s.getSnr()
+ "\t方位角:" + s.getAzimuth() + "\t海拔:"
+ s.getElevation() + "\n";
}
if (count != 0)
Status = "\n搜索到:" + count + "顆衛星\n" + info;
else
Status = "\n未搜索到衛星\n";
// Log.i(TAG, "您當前的位置是:\n" + lastLocation + Status);
intent.putExtra("GPS_info", "您當前的位置是:\n" + lastLocation
+ Status);
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_STARTED:// 定位啟動
Log.i(TAG, "定位啟動");
intent.putExtra("GPS_info", "定位啟動");
sendBroadcast(intent);
break;
case GpsStatus.GPS_EVENT_STOPPED:// 定位結束
Log.i(TAG, "定位結束");
intent.putExtra("GPS_info", "定位結束");
sendBroadcast(intent);
break;
}
}