0
위도와 경도를 전달하여 위치 주소를 얻으려고합니다. 그러나 주소는 항상 null입니다. 안드로이드의 Geocoder
문서에서Google 유리 - 위치에서 주소를 가져올 수 없습니다.
내 코드는 ...
@Override
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
if (location != null){
Geocoder geocoder = new Geocoder(Start_service.this.getBaseContext(), Locale.getDefault());
// lat,lng, your current location
try {
lati= location.getLatitude();
longi=location.getLongitude();
speed=location.getSpeed();
addresses =geocoder.getFromLocation(location.getLatitude(),location.getLongitude(), 1);
System.out.println("Address is"+ addresses);
}
catch (IOException e) {
System.out.println(e);
e.printStackTrace();
}
GPS를 휴대 전화에 연결하면 작동합니다. Wi-Fi로 작동하지 않습니다. –