Might be a stupid question, but I don't know the logic behind.
- On a Wifi enabled device, GPS coordinates are accurate.(as expected)
- Disable Wifi and enable 3G gives a inaccurate coordinates (device location is same as in point 1.).
w开发者_运维技巧hen a distance is calculated from coordinates in point 1. and 2. Google maps shows a 5min walking distance.
could someone explain the above behavior and is it possible to have same coordinates with 3G?.
Android devices have three methods of calculating coordinates:
- GPS: This is the "fine" location and is the only one accurate.
- Wifi: Using a database of hotspots google collected when doing streetview.
- 3G: Using database of base stations and some very rough triangualtion.
So GPS coordinates are always expected to be accurate, but wifi coordinates are not and neither are 3g. Of course the cost of GPS precision is that it needs quite a lot of energy (a few phone batteries last more than 10 hours with GPS running) while wifi and 3g need no extra energy to what wifi/3g would use anyway.
3g coordinates are taken from the 3g towers location (and probably triangulated from multiple towers). As a 3g cell can span several acres around the tower, the coordinate can only give you an approximation.
Also the device may just have cached an old location (especially when location updates come in via GPS and you don't need 3g). I've seen values several dozen miles away - especially when riding on the train and the 3g network handover does not allow for an easy position fix.
精彩评论