Google maps 我想使用谷歌Api或任何其他Api检索巴基斯坦的邮政编码/邮政编码

Google maps 我想使用谷歌Api或任何其他Api检索巴基斯坦的邮政编码/邮政编码,google-maps,geolocation,google-maps-android-api-2,google-geocoder,postal-code,Google Maps,Geolocation,Google Maps Android Api 2,Google Geocoder,Postal Code,我已经在Stackoverflow上讨论了不同的问题,但没有一个能帮我解决。我在我的应用程序中使用谷歌API,需要检索zipcode。目前,我正在获取除zipcode之外的所有其他参数 如有任何建议/指导或帮助,将不胜感激。谢谢 地理编码器 List<Address> addresses; geocoder = new Geocoder(activity, Locale.getDefault()); try { addresses = ge

我已经在Stackoverflow上讨论了不同的问题,但没有一个能帮我解决。我在我的应用程序中使用谷歌API,需要检索zipcode。目前,我正在获取除zipcode之外的所有其他参数

如有任何建议/指导或帮助,将不胜感激。谢谢

地理编码器

    List<Address> addresses;
    geocoder = new Geocoder(activity, Locale.getDefault());

    try {
        addresses = geocoder.getFromLocation(Double.parseDouble(params[0]), Double.parseDouble(params[1]), 1);

        //get current Street name
        String address = addresses.get(0).getAddressLine(0);

        //get current province/City
        String province = addresses.get(0).getAdminArea();

        //get country
        String country = addresses.get(0).getCountryName();

        //get postal code
        String postalCode = addresses.get(0).getPostalCode();
        //get place Name
        String knownName = addresses.get(0).getFeatureName(); // Only if available else return NULL

        return "Street: " + address + "\n" + "City/Province: " + province + "\nCountry: " + country
                + "\nPostal CODE: " + postalCode + "\n" + "Place Name: " + knownName;

    } catch (IOException ex) {
        ex.printStackTrace();
        return "IOE EXCEPTION";

    } 
列出地址;
地理编码器=新的地理编码器(活动,Locale.getDefault());
试一试{
addresses=geocoder.getFromLocation(Double.parseDouble(参数[0]),Double.parseDouble(参数[1]),1);
//获取当前街道名称
字符串地址=地址.get(0).getAddressLine(0);
//获取当前省/市
String province=addresses.get(0.getAdminArea();
//到达国家
字符串country=addresses.get(0.getCountryName();
//获取邮政编码
字符串postalCode=addresses.get(0.getPostalCode();
//获取地名
String knownName=addresses.get(0).getFeatureName();//仅当可用时,否则返回NULL
返回“街道:“+地址+”\n“+”市/省:“+省+”\n国家:“+国家”
+“\n国家代码:“+postalCode+”\n“+”地名:“+knownName;
}捕获(IOEX异常){
例如printStackTrace();
返回“IOE异常”;
} 

如图所示,您似乎需要使用web服务进行此操作。我也使用过web服务,它在巴基斯坦也不显示邮政编码……但在巴基斯坦以外的地方工作正常……您尝试过SmartyStreets吗?此处演示国际地址:。您似乎需要使用此web服务,如图所示。我也使用过web服务,在巴基斯坦也不显示邮政编码……但在巴基斯坦以外的地区工作正常……您尝试过SmartyStreets吗?演示国际地址:。