Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Geocoder geocoder = new Geocoder(this.myContext, Locale.getDefault());
- if (geocoder.isPresent()) {
- try {
- Log.d(TAG, "Try - Latitude: " + this.currentLatitude + "Longitude: " + this.currentLongitude);
- List<Address> address = geocoder.getFromLocation(this.currentLatitude, this.currentLongitude, 1);
- StringBuffer str = new StringBuffer();
- str.append("Name:" + address.get(0).getLocality() + "\n");
- str.append("Sub-Admin Ares: " + address.get(0).getSubAdminArea() + "\n");
- str.append("Admin Area: " + address.get(0).getAdminArea() + "\n");
- str.append("Country: " + address.get(0).getCountryName() + "\n");
- str.append("Country Code: " + address.get(0).getCountryCode() + "\n");
- String strAddress = str.toString();
- Log.d(TAG, "" + strAddress);
- /*for (Cidade city : CidadeManager.INSTANCE.getAll(CidadeManager.OrderBy.ID_ASC)) {
- Log.d("City apikey", address.get(0).getLocality() + "=" + city.getNome());
- if(city.getNome().equals(address.get(0).getLocality())) {
- Log.d("City apikey", "entrou no if");
- //cityAPIKey = city.getApiKeyWrite();
- //Log.d("City apikey", "cityAPIKey = " + cityAPIKey);
- }
- }*/
- } catch (IOException e) {
- Log.d(TAG, "Street Not Found");
- }
- } else {
- Log.d(TAG, "Geocoder is not present");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement