Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:40:42+00:00 2026-06-10T08:40:42+00:00

I am getting a very stupid problem lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ll); float spd =

  • 0

I am getting a very stupid problem

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ll);
    float spd = myLoc.distanceTo(previousLocation) / (myLoc.getTime() - previousLocation.getTime());

previous location is the myLoc stored last time onLocationChanged was called i-e each after 1 second.

Now my problem is, sometimes it gives extremely big peak values. making spd go way higher than it usually is.

Anyone can tell how can i reduce this

Best Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:40:44+00:00Added an answer on June 10, 2026 at 8:40 am

    A few recommendations:

    1. Check Location.hasSpeed() to see if this information is provided for you. It may be more reliable than your calculation, though I don’t know anything about the algorithm used to produce this value.

    2. Check Location.getAccuracy() to decide when to ignore a particular fix for calculating speed.

    3. Read these tips thoroughly to see an example of how to be selective when dealing with GPS results. They could be too old or too imprecise to be used for speed. http://developer.android.com/guide/topics/location/strategies.html#Updates

    4. For an app I worked on, I implemented a filter that compared the current location to the two previous locations and used the lowest calculated speed. You may need a more or less complex method to determine speed that will be useful for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a very peculiar problem with my asp.net application, it took me an
After doing a project with WPF and getting very much attached to it's excellent
I notice that I am getting very poor performance for either or both inserts
I'm getting some very strange behaviour using the following switch statement: string recognise_mti(int mti_code)
I'm getting a very weird exception when trying to deploy my app on JBOSS
I am getting a very strange error in my code. This assignment is for
I'm getting some very wierd errors. The compiler seems to want to call the
I have just started getting a very strange error when using jQueryMobile for my
I am looking for some advice in regards to getting a very quick display
I'm doing an IRC message parser with Boost.Spirit but I'm getting a (very long)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.