【问题标题】:Geocoder suddenly stopped working地理编码器突然停止工作
【发布时间】:2016-07-23 06:40:50
【问题描述】:

我正在使用 Geocoder 来获取我的 android 应用程序中的经纬度。前段时间它工作得很好,但现在它刚刚停止工作。我没有更改代码。为什么会这样?

public void onItemClick(AdapterView adapterView, View view, int position, long id) {
        String str = (String) adapterView.getItemAtPosition(position);
    List<Address> addressList= null;
            if(str != null || str.equals("") ){
                Geocoder geocoder = new Geocoder(this);
                try {
                    addressList = geocoder.getFromLocationName(str, 1);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                Address address = addressList.get(0);
                //LatLng latLng = new LatLng(address.getLatitude(),address.getLongitude());
                Intent i = new Intent(Activity2.this, MainActivity.class);
                i.putExtra("location", str);
                i.putExtra("latitude", address.getLatitude());
                i.putExtra("longitude", address.getLongitude());
                startActivity(i);
            }
}

谢谢!!

【问题讨论】:

  • 为什么有人反对投票?至少告诉我们哪里出了问题?
  • 此呼叫需要互联网连接。当它不工作时你有互联网连接吗?
  • 是的,我有互联网连接。它在 7-8 小时前运行良好。
  • 服务可能不可用?看看这里:stackoverflow.com/questions/7109240/… 检查你的日志输出......

标签: android google-maps geocoding geocode


【解决方案1】:

您是否收到IOException: Timed out waiting for response from server 错误?因为我已经看过其他帖子,其中提到 Geocoder 无法正常运行,即使它早些时候(几小时/几天前)也是如此。我去了公共票 - https://code.google.com/p/gmaps-api-issues/issues/detail?id=9153 - 这是去年一月发生这种情况时制作的,似乎还有其他人正在经历这种情况。您确实提到您没有修改代码中的任何内容,对吧?

【讨论】:

    猜你喜欢
    • 2018-05-11
    • 1970-01-01
    • 2017-08-22
    • 2021-02-01
    • 2016-12-29
    • 2018-05-09
    • 2015-12-07
    • 2015-08-23
    相关资源
    最近更新 更多