有没有办法准确判断用户在使用Android位置管理器哪个城市在美国​​?没有办法、管理器、准确、在美国

由网友(战磕贝斯手.)分享简介:我试图确定在美国的城市用户使用来自Android应用程序的当前位置。我想使用GPS的位置提供但如何准确地判断可以从城市或区域设置的名称,纬度/经度数据。I am trying to determine the city in USA the user is in using their current locatio...

我试图确定在美国的城市用户使用来自Android应用程序的当前位置。我想使用GPS的位置提供但如何准确地判断可以从城市或区域设置的名称,纬度/经度数据。

I am trying to determine the city in USA the user is in using their current location from an Android App. I want to use the GPS as the location provider but how accurately can I determine the name of the city from the Locale or Latitude / Longitude data.

比如我注意到了Twitter的应用程序来确定你是在曼哈顿曼哈顿啁啾的时候,但有可能从位置数据检索纽约市的曼哈顿,而不是也和洛杉矶,而不是比佛利山庄。

For instance I noticed the twitter app determines you are in Manhattan when tweeting from Manhattan, but is it possible to retrieve New York City instead of Manhattan from the location data and likewise Los Angeles instead of Beverly Hills.

这是因为所有我需要确定的是用户在按当前位置在哪个城市。

This is because all I need to determine is which city the user is in as per the current location.

感谢所有帮助。

推荐答案

您需要的地理codeR类。见参考,这是很容易使用:的http://开发商.android.com /参考/安卓/位置/地理位置coder.html 。你提的这个过程被称为反向地理编码。我认为这是相当准确的(特别是如果只需要一个城市的名字),我用它在我的一些项目。

You need the Geocoder class for that. See the reference, it's quite easy to use: http://developer.android.com/reference/android/location/Geocoder.html . The process you're mentioning is called reverse geocoding. I think it's quite accurate (especially if only the city name is needed), I've used it in some of my projects.

但是,如果您只想确定用户当前的城市,它可能是足够使用的小区信息,而不是那么GPS提供商。对于GPS工作,用户必须以外,基于小区信息的提供者工作得很好建筑物内太

But if you only want to determine the city the user's currently in, it might be enough to use the cell information for that, rather then the gps provider. For the gps to work, the user has to be outside, the provider based on cell info works quite well inside buildings too.

阅读全文

相关推荐

最新文章