안녕하세요
제가 원하는 것은 현재 측정되는 GPS의 위성 개수를 출력하고자 하는것입니다.
측정되는 위성 종류가 In view(관측되는 위성), In use(실제 거리계산 가능한 위성) 으로 나뉜다고 알 고 있습니다.
아무튼 , 구글 검색 결과
private boolean isGPSEnabled = false;
private boolean registGps = false;
@Override
public void onGpsStatusChanged(int event) {
GpsStatus status = locationManager.getGpsStatus(null);
Iterable sats = status.getSatellites();
Iterator satI = sats.iterator();
int count = 0;
while (satI.hasNext()) {
GpsSatellite gpssatellite = (GpsSatellite) satI.next();
if (gpssatellite.usedInFix()) {
count++;
}
}
if (count > 3) {
isGPSEnabled = true;
if (!registGps) {
locationManager.removeUpdates(this);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,2000, 0, this);
registGps = true;
CommFun.ToastMsgDebug(this,
"현재 GPS 위성 갯수 : provider=gps," + count);
}
} else {
isGPSEnabled = false;
}
}
[출처 : http://bbunge.tistory.com/154]
위와 같은 방법을 알게 되었는데요..
문제는 import android.location.GpsStatus; 를 하면
The type GpsStatus is deprecated라고 사용할 수 없다고 까만줄이 딱 그어 집니다...ㅠㅠ
GpsStatus는 더 이상 사용할 수 없는 class 인가요??
개발 환경은 안드로이드 5.0.1 이고 이클립스를 사용해서 코딩했습니다.
혹시 다른 방법이나 해결책 좀 알려주시면 대단히 감사하겠습니다. ㅠㅠ