问题描述
该应用程序使用地理codeR 的对象。它工作正常,在我的股票升级Froyo的Nexus One。但后来我运行一个不同的设备(一个临维加10平板电脑也运行升级Froyo)在完全相同的应用程序,我得到这个异常:服务不可用的我使用的方法是 getFromLocationName()
,我建立针对Android 1.6的谷歌API。
The app uses the Geocoder object. It works fine on my stock Froyo Nexus One. But then I run the exact same app on a different device (an Advent Vega 10" tablet also running Froyo) and I get this exception: Service not Available. The method I'm using is getFromLocationName()
, I'm building against the Android 1.6 Google API.
我知道如果这异常被抛出在模拟器上的问题,但我怀疑这是不同的。为什么会是一台设备上运行升级Froyo,但在抛出不是其他?
I'm aware of an issue where this exception is thrown on the emulator, but I suspect this is different. Why would it be thrown on one device running Froyo but not another?
该应用程序是一个位置的应用程序,并作为平板电脑没有GPS或移动网络,在这样一个场景,在Wi-Fi连接,并没有提供一个位置,用户必须手动指定,所以不能够使用地缘codeR对象是个坏消息。
The app is a location app, and as the tablet has no GPS or mobile network, in a scenario where the Wi-Fi connection doesn't provide a location, the user must manually specify it, so not being able to use the Geocoder object is bad news.
我可以添加一个方法让用户选择在地图上的位置,但它并不理想。也许我可以直接使用谷歌地图API,但我渴望先了解问题的性质将是很好有一个简单的解决方案。
I could add a way for the user to select the location on a map, but it's not ideal. Possibly I could use the Google Maps API directly, but I'm keen to understand the nature of the issue first as would be nice to have an easier solution.
我希望在未来的版本的Android包括操作系统级别的默认位置非地理codeR装置,所以位置感知应用程序工作的开箱即用像谷歌电视设备。
Hopefully in a future release Android will include an OS-level "default location" for non-Geocoder devices, so location-aware apps work out of the box on devices like Google TV.
推荐答案
我问谷歌的雷托•迈耶,以确认我的理论是正确的,他说的正确的地理codeR是谷歌API的一部分添加-on不属于AOSP的一部分。的
I asked Google's Reto Meier to confirm my theory was correct and he said "Correct. The Geocoder is part of the Google API add-on that isn't part of the AOSP."
因此,任何设备不附带Play商店时,Gmail应用程序等等也将缺少地理codeR后端。
So any device that doesn't come with the Play Store, GMail apps etc… will also be missing the Geocoder back-end.
这篇关于为什么Android的地理codeR扔"服务不可用"例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!