GPS를 시켜서 위치를 받아오는데 10초 동안만 작동 시키고
못 받으면 GPS 작동을 멈추게 하는..것을 구현하고 싶습니다...
기본적으로..많은 소스들이 널려 있는데...
어떻게 하면..가능 할가요..?ㅡㅡ;;
불가능한거 같은데...구현 하신분 계시면 쫌 가르쳐주세요..ㅠㅠ
LocationListener mLocationListener;
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
mLocationListener = new LocationListener() {
public void onLocationChanged(Location location) {
updateWithNewLocation(location);
if (location != null) {
Toast.makeText(context,"위도는 " + location.getLatitude() + ", " + "경도는 "+ location.getLongitude() + " 입니다.",Toast.LENGTH_SHORT).show();
}
}
public void onProviderDisabled(String arg0) {
}
public void onProviderEnabled(String arg0) {
}
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
//Toast.makeText(context, "args0 : " +arg0+ ", arg1 : " +arg1+ "arg2 : "+ arg2, Toast.LENGTH_SHORT).show();
}
};
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 5,mLocationListener);
제가 모토로이를 사용하는데 보통 40초이상 걸리는 경우도 있더군요..
어떤 네비업체가 GPS를 수신해서 위치를 빨리 잡는것을 특허냈다고 하는데
GPS가 쉬운게 아닌것 같더군요..