Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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 <a href="http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28long,%20float,%20android.location.Criteria,%20android.app.PendingIntent%29" rel="nofollow">LocationManager.requestLocationUpdates()</a>). 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.</p> <p>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.</p> <p>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).</p> <p><strong>UPD</strong> 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 <a href="http://developer.android.com/reference/android/location/Location.html#getTime%28%29" rel="nofollow">getTime()</a> 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 :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COThank you! I've tested my application again today and it's working better than yesterday. Although there are times that the marker will still jump from one place to another. I haven't change anything on my code so it seems that I'm just in a bad location yesterday. I'm not directly using a LocationManager as I'm just reusing the MyLocationOverlay class by extending it. Should I create a LocationManager? By the way, do you know how often does the MyLocationOverlay gets updated?
      singulars
    2. COGiving fake location updates have also come up to my mind but I decided not to implement it because there are lot of problems that could arise from it such as what if the user suddenly changes his direction or what if he is facing west when he's going east, etc. I've checked the getTime method. I haven't notice it before. Thanks for the tip!
      singulars
    3. COYou don't have to create LocationManager :) here: http://developer.android.com/guide/topics/location/obtaining-user-location.html is an example on how to obtain it, but you don't need it so long as you're using MyLocationOverlay - there are enable/disable- myLocation() methods that already do that internally. You can't set frequency of MyLocationOverlay updates (see answer here http://stackoverflow.com/questions/8394867/how-do-you-implement-follow-me-using-the-mylocationoverlay-class), so if you want full control over the frequency you'll have to write your own overlay and listener.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload