地理编码器抛出异常:服务在 Android (Google api) 2.3.3 中不可用
我正在使用 GeoCoder 在我的应用程序中获取位置。以下代码是:
Geocoder geoCoder = new Geocoder(this);
try {
List<Address> addresses = geoCoder.getFromLocationName("", 1);
if(null != addresses && addresses.size() > 0){
address = addresses.get(0);
List<Overlay> mapOverlay = mapView.getOverlays();
//This is new class to get address on basis on latitude and longitude
AddressOverlay addressOverlay = new AddressOverlay(address);
mapOverlay.add(addressOverlay);
final MapController mapController = mapView.getController();
//Start animating the map towards the given point.
mapController.animateTo(addressOverlay.getGeoPoint(), new Runnable(){
public void run(){
mapController.setZoom(12);
}
});
}else{
//No results for that address.
}
我收到异常:第一行服务不可用(尝试后)。有没有人可以指导我并提供解决此问题的步骤?
等待及时回复!!
I am using GeoCoder for getting the location in my application. The following code is:
Geocoder geoCoder = new Geocoder(this);
try {
List<Address> addresses = geoCoder.getFromLocationName("", 1);
if(null != addresses && addresses.size() > 0){
address = addresses.get(0);
List<Overlay> mapOverlay = mapView.getOverlays();
//This is new class to get address on basis on latitude and longitude
AddressOverlay addressOverlay = new AddressOverlay(address);
mapOverlay.add(addressOverlay);
final MapController mapController = mapView.getController();
//Start animating the map towards the given point.
mapController.animateTo(addressOverlay.getGeoPoint(), new Runnable(){
public void run(){
mapController.setZoom(12);
}
});
}else{
//No results for that address.
}
I am getting exception: Service is not available on 1st line (just after try). Is there any person who can mentor to me and provide the steps to resolve this problem?
wait for prompt response!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论