我正在尝试使用Geocoder.getFromLocationName()方法,尽管在以下实际设备上相同的搜索字符串可以正常工作:
- Nexus 1 (2.3.6)
- Samsung Galaxy SIII (4.0.4)
- Galaxy Nexus (4.1.1)
但在我的Nexus 7(4.1.1)上,该方法会抛出“Service not available” IOException异常。
以下是简化代码:
Geocoder geocoder = new Geocoder(mContext);
List<Address> addressFromSearch = geocoder.getFromLocationName("10918", 1);
我也尝试了使用移动数据和仅wifi连接的每个设备,它们都可以正常工作。到目前为止,唯一不能工作的设备/操作系统是Nexus 7。我还检查了Geocoder.isPresent() -- 它返回true。
你有什么想法吗?可能我错过了什么?