How to get Location with Wifi in Android?

前端 未结 2 649
广开言路
广开言路 2021-01-05 13:55

I Want get location with Wifi and work in Google map, and it\'s not work for me but Gps is okay and not problem.

my code:

locationManager = (Location         


        
2条回答
  •  一生所求
    2021-01-05 14:27

    If you are connected to WIFI then simply use NETWORK PROVIDER for your location updates. they will be fast and enough accurate too.

    generally if location updates are not required so frequently then location updates are asked from both GPS and NETWORK together at the same time. whenever you get a location update of desired accuracy unregister from listening location updates.

    But if location updates are required frequently then calling GPS can be a KILLER OF BATTERY too so be careful of using GPS PROVIDER.

    GPS Updates are available good under open sky only. GPS Updates takes time , takes battery but Are More Accurate.

    Network Updates are quicker, consumes less battery but are comparatively less accurate. But if we are talking about a WIFI accuracy it will be near to 50 or 100 that can serve many real time requirement.

    It all depends on your requirement.

提交回复
热议问题