Geocoder isPresent()在android地理编码器中失败

时间:2014-11-12 08:23:34

标签: android google-geocoder

我在android

中使用GeoCoder
  • 我正在使用isPresent()检查GeoCoder服务是否正常 在应用程序中运行

逻辑:

if(GeoCoderObject.isPresent()){
 Log.d("Message","GeoCoder instance is there");
 try{
  someMethod();
}
catch(IOException){
 Log.d("Message","Wiered Scenario");
}
catch(Esception e){
 Log.d("Message","Geocoder service not available");
}
}else{
 Log.d("Message","GeoCoder instance is not there");
}

引发异常:

java.io.IOException: Service not Available

输出中显示的日志为:

  • Wiered Scenario

This is a similar behaviour as seen in another answer of stackoverflow here


问题:

  • 我可以捕获那个特殊的异常,如果它被引发则会创建一个新的实现,但是有任何方法可以检查 这个场景!

注意: 这个isPresent()昨天与设备完美配合。今天它提出了这个错误(没有进行代码更改)

0 个答案:

没有答案