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

  • Home
  • SEARCH
  • 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 7431041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:14:02+00:00 2026-05-29T09:14:02+00:00

I am using MyLocationOverlay to display the current location. However, it takes a while

  • 0

I am using MyLocationOverlay to display the current location. However, it takes a while for the location to get updated. I wanted to implement something like the “follow me” feature on iPhone wherein the location of the user is also moving as the user moves. How can I make the marker of MyLocationOverlay to perform live update on its location?

Please note that I override the draw() and drawMyLocation() because I need to draw a custom marker.

My current code looks like this: (The problem with my code is that the marker does not move along with the user. Since it takes a while before onLocationChanged is called, the marker will just suddenly jump from one place to another.)

@Override
public synchronized void onLocationChanged(Location location)
{
    if (location != null && mapController != null)
    {
        //Recenter map based on current location
        mapController.animateTo(new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6)));
    }
    super.onLocationChanged(location);
}
  • 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-05-29T09:14:03+00:00Added an answer on May 29, 2026 at 9:14 am

    You can give location manager minimal interval to wait between calling that method, but it’s not exactly going to mind that interval 100% of the time (see description of LocationManager.requestLocationUpdates()). Might be shorter, might be longer – because, e.g. it can be cloudy and gps chip won’t be able to get location updates as regularly as you’d want it to.

    There’s no proper way to overcome this – location services will always have imperfections. Every location-aware app I used “hung” the marker from time to time because gps chip lost fix for a moment.

    The only thing you can do to smooth this a bit is to remember the speed of movement and should gps lose fix give the map marker fake updates based on the assumption that the user is moving in the same direction with the same speed they were when gps had a fix. But it only makes sense to do that for like 2-5 skipped real updates (just to smooth the cases when fix is lost for several seconds).

    UPD For that, you can implement kind of proxy location listener, which will update your marker strictly minding the intervals you specify, e.g. every 200 ms, and do so based on it’s stored location. And the stored location can be asynchronously updated by the real location listener. Location objects have time of the fix that provided data (see getTime() method), you can use that to determine whether you should still “predict” next marker movement or the location is old enough to give up and notify user that gps has no clue where they are 🙂

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

Sidebar

Related Questions

I'm testing current gps location application using samsung spica 1.5 but it doesn't display
I'm trying to get my current location and show it on a map. Class
I made an application which shows the current location of the user using the
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using jQuery, how do I get the value from a textbox and then load
Using the RichTextArea in GWT, It looks like I can only change the font
I am having an issue calculating distance using the Location.distanceTo method. private class MyLocationOverlay1
using file_get_contents , I open an Internet URL and get the contents of this
My code currently displays the users location on a map... using the code below

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.