서비스 제공 업체 정보를 얻을 수 없지만 위치를 알 수 있습니다. 장치를 설치하는 동안 구성된 우편 번호에서 위치를 얻을 수있는 "정적"위치 제공자를 사용
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation("static");
Geocoder geocoder = new Geocoder(this);
Address address = null;
try {
address = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1).get(0);
Log.d("Zip code", address.getPostalCode());
} catch (IOException e) {
Log.e(TAG, "Geocoder error", e);
}
은 "android.permission.ACCESS_COARSE_LOCATION"권한이 매니페스트에 필요합니다. URI가 공급자에 대한 변경
에는 perm이 필요합니다. –
larham1