On Tue, Oct 26, 2010 at 11:54 AM, tarek attia <[email protected]> wrote:
> Dear all,
>
> Just in my application I want to get the speed of the android device
> using the GPS,so I use the api of location.getspeed()
>
> http://developer.android.com/reference/android/location/Location.html#getSpeed%28%29
>
> However all the speed I got is just incorrect ,,,and the values are
> very different from the actual one !!!!

How different?

Few things to look at is:
- right permission (i.e. android.permission.ACCESS_FINE_LOCATION)
- request periodic location from LocationManager
- remember that the speed readings will start coming through only
after GPS fixes on some satellites, which takes time. This is because
you are reading an average speed, not actual speed.
- get the Location object in on LocationListener.onLocationChanged()
to call hasSpeed() and only when that call returns true, read the
speed
- results are in meters per second

Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to