How to calculate distance between two points while walking (without GPS)
The android's distanceTo() and distanceBetween() function gives results when I reach the destination lat and lon. But I need to cover the case when latitude and longitude may not be changed (e.g. if I walk in the street with high buildings around, enter the building or walk short distance by taking more turns). For those conditions how to cal开发者_运维知识库culate distance in android?
When I was searching through stackoverflow others answers, I gone through here.
I tried the following answer. The code is good and fine but when I tried to calculate distance by that code everytime it gives a constant value even when I am not walking.
Please help me in calculating the distance between two points
When you enter the building you have GPS lat/long, but after that it will not change because there is no GPS coverage. So, question is how to handle such a case, having just last position. I would approach that interesting issue this way:
Use WiFi networks info for location as well (not just GPS).
Use sensors. You have orientation and accelerator sensors. I remember some phones having feature of number of steps counting (I had that on SonyEricsson without GPS).
Accelerator sensor may give you info if person is moving and help you to count the number of steps (you need to take some average step distance value estimate). You can easily conclude if person is in the elevator, and if he is going up or down, and roughly estimate number of floors.
Orientation sensor may give you info about direction of movement change (turning around the corner).
GSM signal strength based location. NeighboringCellInfo from
android.telephony
gives you information about RSSI (Received Signal Strength Indication) for cells around you, but for accurate calculation of the position (approx 50 m precision) based on triangulation you need exact position of Base stations (which you cannot get without support from the operator).
It is understood how inaccurate such estimation may be, but I see no other approach.
In any case, stuff for lots of fun exploring/developing.
精彩评论