开发者

Android: Force use of Wi-Fi as Location Provider

As I understand it, I have three location providers to choose from: GPS, Network and Passive.

I would like to obtain my location by detecting the Wi-Fi network I'm connected to, I believe both Cell Triangulation and Wi-Fi location determination is covered under the Network provider.

However, despite being connected to a Wi-Fi access point, my program always seems to use cell triangulation rather than Wi-Fi to determine my location (assumed based on the huge inaccuracy of the returned coordinates).

It doesn't look like there's any way to force the use of Wi-Fi only? How does Androi开发者_StackOverflowd decide when to use Wi-Fi over cell triangulation?


I think it uses wifi when the wifi information scanned from the wifi chipser matches data the remote Google database (I don't know the coverage of this database, but it should include all cities that have StreetView). Else it uses the far less accurate cell triangulation.

To check which kind is used, you might try LocationProvider.requireCell() (haven't tested it...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜