Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Implement Responsive User Location Tracking Mode #2049

Closed

Description

@bleege

The User Location tracking mode (None, Follow, Bearing) was disabled in #1856 as the User Location dot was being updated on the main UI thread. The core logic is there, but it needs to be implemented in a more efficient way so that the UI remains responsive.

/cc @erf

Activity

  1. added
    Android
    on Aug 12, 2015
  2. added this to the milestone on Aug 12, 2015
  3. erf commented on Aug 12, 2015

    @erf
    Contributor

    Could it be added as an annotation?

  4. ljbade commented on Aug 13, 2015

    @ljbade
    Contributor

    @bleege Is the issue that there is too many events?

  5. erf commented on Aug 13, 2015

    @erf
    Contributor

    i made a lowpass filter in #1968 which could be used

  6. erf commented on Aug 13, 2015

    @erf
    Contributor

    in addition to some minimal time / angle diff

  7. erf commented on Aug 13, 2015

    @erf
    Contributor

    I think you should move out the setDirection call from updateMap to the onCompassChange event.

  8. bleege commented on Aug 13, 2015

    @bleege
    ContributorAuthor

    @bleege Is the issue that there is too many events?

    Yes.

  9. ljbade commented on Aug 13, 2015

    @ljbade
    Contributor

    @bleege How does iOS handle that?

  10. 1ec5 commented on Aug 14, 2015

    @1ec5
    Contributor

    @ljbade, on iOS, MGLMapView doesn’t do anything special. But it seems that Core Location is doing a better job of coalescing location updates than what we’re using on Android: #1676.

  11. bleege commented on Aug 14, 2015

    @bleege
    ContributorAuthor

    But it seems that Core Location is doing a better job of coalescing location updates than what we’re using on Android

    Exactly. We need to put a regulator / distance filter on updates to location or specifically that a certain amount of distance / time needs to elapse before updating the dot on the map.

  12. ljbade commented on Aug 15, 2015

    @ljbade
    Contributor

    @bleege I recall the LOST framework has this ability to filter (certainly Google Play services do).

    We still need to work in @erf's compass filter for that data.

  13. ljbade commented on Aug 15, 2015

    @ljbade
    Contributor

    I was getting confused between location/GPS events and map position change events.

  14. modified the milestones: , on Aug 26, 2015
  15. 97 remaining items

  16. tobrun commented on Dec 8, 2015

    @tobrun
    Member

    I'm working on this again, because I have noticed 2 bugs on current progress that need to fixed asap

  17. tobrun commented on Dec 17, 2015

    @tobrun
    Member

    To clarify above:

  18. tobrun commented on Dec 23, 2015

    @tobrun
    Member

    The new camera API from @bleege will help resolve remaining issue on this ticket:

    #3396 contains the fix for animated location updates with user tracking mode enabled.

    Todo list to close this issue:

  19. Buckley404 commented on Jan 2, 2016

    @Buckley404

    Is this working correctly now?

    Currently when I try to set up tracking in the onCreate it draws the blue marker in the top left corner, digging through the code on git I found that this was because the position of the marker is being set relative to the mapview by dividing width and height by 2 (height and width would be 0 while onCreate is being called).

    I altered my code to include a button I could press to start tracking in order to bypass the problem, however even though the screen is centred on the correct position, the blue dot does not draw to the screen.

    In the UserLocationView class and in the update method, why are you setting the blue marker position by dividing the screen/height width by 2 to find the centre point of the screen. Why not use the latitude and longitude to draw the marker like you would with a regular addMarker call or a screen centre?

    If the code even worked properly, wouldn't moving around the map with user input reposition the blue dot in the wrong place i.e. keep it in the centre of the screen no matter where the user navigates to on the map?

  20. tobrun commented on Jan 5, 2016

    @tobrun
    Member

    @Buckley404, reading through your comment I believe you are using the incorrect method. If you want the user location to show on the map in similar fashion as a marker you should call

    nMapView.setMyLocationEnabled(true);

    instead of:

    nMapView.setMyLocationTrackingMode(MyLocationTrackingMode.TRACKING_FOLLOW);

    Let me know if you have any other questions.

  21. tobrun commented on Jan 5, 2016

    @tobrun
    Member

    #3397 landed with f80673b

  22. tobrun commented on Jan 5, 2016

    @tobrun
    Member

    One thing I need to add to this is that current compass implementation is not on par with the one from Google. Current implemented code using accelerometer and magnetometer is generally spoken the accepted way of implementing a compass (as seen in books, SO and tutorials). It seems Google is adding some extra elements to the equitation or using another configuration to calculate values. One of the most notable differences is that Google's implementation is not impacted when switching perspective or tilting the device.

  23. Buckley404 commented on Jan 5, 2016

    @Buckley404

    Thanks again @tobrun, I'll recheck my code after work however I think I was using both methods. I must have just confused myself. FYI google might just be setting minimum thresholds for when the compass should be affected by gyro.

  24. tobrun commented on Jan 5, 2016

    @tobrun
    Member

    @Buckley404 I have been trying to mimic their behaviour for quite some time and I now believe that Google is doing something different than just using the sensors as we are doing.
    FYI I added thresholds in latest code, we could further optimise this by implementing a low pas filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions