Android:地理编码器在 3G 上成功,但在 WiFi 上失败
我正在尝试从位置名称检索地址,如下所示:
Geocoder gc = new Geocoder(MainActivity.this, Locale.getDefault());
List<Address> addresses = null;
try {
addresses = gc.getFromLocationName("Dalvik, Iceland", 1);
} catch (IOException ex){
ex.printStackTrace();
}
它在 3G 连接上工作正常,但在连接到 WiFi 接入点时失败。 (当然,WiFi 提供互联网,并且它可以在其他应用程序中工作)
堆栈跟踪:
02-20 00:06:42.410: W/System.err(25061): java.io.IOException: RPC failed with status 1
02-20 00:06:42.420: W/System.err(25061): at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
02-20 00:06:42.420: W/System.err(25061): at ru.dfrank.study.ecomobile.MainActivity.onCreate(MainActivity.java:101)
02-20 00:06:42.420: W/System.err(25061): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
02-20 00:06:42.420: W/System.err(25061): at android.os.Handler.dispatchMessage(Handler.java:99)
02-20 00:06:42.420: W/System.err(25061): at android.os.Looper.loop(Looper.java:130)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.main(ActivityThread.java:3701)
02-20 00:06:42.420: W/System.err(25061): at java.lang.reflect.Method.invokeNative(Native Method)
02-20 00:06:42.420: W/System.err(25061): at java.lang.reflect.Method.invoke(Method.java:507)
02-20 00:06:42.420: W/System.err(25061): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
02-20 00:06:42.420: W/System.err(25061): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
02-20 00:06:42.420: W/System.err(25061): at dalvik.system.NativeStart.main(Native Method)
我使用 API 级别 7。 我在 stackoverflow.com 上进行了很多搜索和搜索,但仍然找不到答案。
任何帮助表示赞赏。
I am trying to retrieve address from location name like that:
Geocoder gc = new Geocoder(MainActivity.this, Locale.getDefault());
List<Address> addresses = null;
try {
addresses = gc.getFromLocationName("Dalvik, Iceland", 1);
} catch (IOException ex){
ex.printStackTrace();
}
It works fine on 3G connection, but fails when i connected to WiFi access point. (of course, WiFi provides internet, and it works in another applications)
Stack trace:
02-20 00:06:42.410: W/System.err(25061): java.io.IOException: RPC failed with status 1
02-20 00:06:42.420: W/System.err(25061): at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
02-20 00:06:42.420: W/System.err(25061): at ru.dfrank.study.ecomobile.MainActivity.onCreate(MainActivity.java:101)
02-20 00:06:42.420: W/System.err(25061): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
02-20 00:06:42.420: W/System.err(25061): at android.os.Handler.dispatchMessage(Handler.java:99)
02-20 00:06:42.420: W/System.err(25061): at android.os.Looper.loop(Looper.java:130)
02-20 00:06:42.420: W/System.err(25061): at android.app.ActivityThread.main(ActivityThread.java:3701)
02-20 00:06:42.420: W/System.err(25061): at java.lang.reflect.Method.invokeNative(Native Method)
02-20 00:06:42.420: W/System.err(25061): at java.lang.reflect.Method.invoke(Method.java:507)
02-20 00:06:42.420: W/System.err(25061): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
02-20 00:06:42.420: W/System.err(25061): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
02-20 00:06:42.420: W/System.err(25061): at dalvik.system.NativeStart.main(Native Method)
I use API level 7.
I googled and searched in stackoverflow.com very much, but still can't find the answer.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论