1

Android アプリから現在の場所を使用して、ユーザーがいる米国の都市を特定しようとしています。GPS をロケーション プロバイダーとして使用したいのですが、ロケールまたは緯度 / 経度のデータから都市の名前をどの程度正確に判断できるでしょうか。

たとえば、マンハッタンからツイートすると、Twitter アプリがマンハッタンにいると判断することに気付きましたが、位置データからマンハッタンの代わりにニューヨーク市を取得し、ビバリーヒルズの代わりにロサンゼルスを取得することは可能ですか.

これは、ユーザーが現在の場所に基づいてどの都市にいるのかを判断する必要があるためです。

すべての助けをありがとう。

4

1 に答える 1

3

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.

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.

于 2010-10-14T17:36:26.697 に答える