안드로이드 개발 질문/답변
(글 수 45,052)
현제 책으로 공부하고 있습니다.. 그런데 여기 작성된것들은 1.5 기준으로 되어있더군요..
제가 지금 만들고있는 버전은 2.1 버전입니다..
gps 는 2.1 에서 아직은 공개된 소스로는 돌리는것이 불가능하나요?
검색하다, 자기위치 찾는 예제 소스 코드발견했습니다. 밑에는 소스코드와, 에러코드입니다.. 한번 봐주세요.
gps 만들려면 어쩔수없이 1.5 버전에서 만들어야 하는지 ㅜ_ㅜ;.
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
}
private void updateWithNewLocation(Location location){
String latLongString;
TextView myLocationText;
myLocationText = (TextView)findViewById(R.id.myLocationText);
if(location != null)
{
double lat = location.getLatitude();
double lng = location.getLongitude();
latLongString = "위도:"+lat+"\n경도:"+lng;
}
else
{
latLongString = "위치를 찾을수 없음";
}
myLocationText.setText("당신의 현제 위치는:\n"+latLongString);
}
}
[2010-04-13 03:50:22 - tset]Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2010-04-13 03:50:22 - tset]Please check logcat output for more details.
[2010-04-13 03:50:22 - tset]Launch canceled!
제가 지금 만들고있는 버전은 2.1 버전입니다..
gps 는 2.1 에서 아직은 공개된 소스로는 돌리는것이 불가능하나요?
검색하다, 자기위치 찾는 예제 소스 코드발견했습니다. 밑에는 소스코드와, 에러코드입니다.. 한번 봐주세요.
gps 만들려면 어쩔수없이 1.5 버전에서 만들어야 하는지 ㅜ_ㅜ;.
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
}
private void updateWithNewLocation(Location location){
String latLongString;
TextView myLocationText;
myLocationText = (TextView)findViewById(R.id.myLocationText);
if(location != null)
{
double lat = location.getLatitude();
double lng = location.getLongitude();
latLongString = "위도:"+lat+"\n경도:"+lng;
}
else
{
latLongString = "위치를 찾을수 없음";
}
myLocationText.setText("당신의 현제 위치는:\n"+latLongString);
}
}
[2010-04-13 03:50:22 - tset]Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2010-04-13 03:50:22 - tset]Please check logcat output for more details.
[2010-04-13 03:50:22 - tset]Launch canceled!
왠지 구글맵 API를 이용한 예제 같군요.
버전문제라기 보다는 Google API가 빠진 라이브러리를 사용하시는 데서 발생하는 문제 같습니다.