user1564622
user1564622

Reputation: 63

measure short distance android GPS

I am trying to get the distance from a predetermined location set by the user, to the users current position. The problem is that the distance it returns is all over the place, and is very inaccurate. Also, SkettiList.get(i).Lat and SkettiList.get(i).Lon are the constant Longitude and Latitude of the position the user set, and Lat and Lon are the users current Latitude and Longitude positions. Here is my code:

float[] results=new float[1];
Location.distanceBetween(SkettiList.get(i).Lat, SkettiList.get(i).Lon,Lat,Lon, results);
Log.i("SKT: ",results[0]+"");

Upvotes: 0

Views: 256

Answers (1)

mjstam
mjstam

Reputation: 1079

GPS is only going to be so so for short distances and if you are stationary will bounce around a little.

That said you should make sure you are using FINE

<manifest ... >
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    ...
 </manifest>

http://developer.android.com/guide/topics/location/strategies.html

On my applications I throw away anything that is not at least 10 meters different then the last location received.

Upvotes: 1

Related Questions