我正在尝试使用 Geocoder.getFromLocationName(),尽管相同的搜索字符串在这些实际设备上工作正常:
- 连结 1 (2.3.6)
- 三星 Galaxy SIII (4.0.4)
- 银河连结 (4.1.1)
在我的 Nexus 7 (4.1.1) 上,该方法抛出“服务不可用”IOException
这是简化的代码:
Geocoder geocoder = new Geocoder(mContext);
List<Address> addressFromSearch = geocoder.getFromLocationName("10918", 1);
我还尝试了每台使用移动数据和仅使用 wifi 的设备,它们都运行良好。到目前为止,唯一不工作的设备/操作系统是 Nexus 7。我还检查了 Geocoder.isPresent() - 它返回 true。
对我可能遗漏的东西有什么想法吗?
最佳答案
在 Galaxy Nexus 的 OTA 更新到 4.1.2 之后,这个问题终于解决了。这是一个关于 Android 版本 4.1.1 的错误
关于Android/Nexus 7 为 Geocoder.getFromLocationName() 抛出 IOException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12700077/