Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually set the first location update #428

Closed
wants to merge 1 commit into from

Conversation

LukasPaczos
Copy link
Contributor

Closes #424.
Animators need two values to start animation and push updates to the LocationLayer that's why we need to set the first location sample manually.

/cc @hangduykhiem @danesfeder @langsmith @Guardiola31337

@LukasPaczos LukasPaczos added the location-layer-plugin Issues that deal with the location layer module label Apr 16, 2018
@LukasPaczos LukasPaczos added this to the location-layer-0.5.0 milestone Apr 16, 2018
Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasPaczos I'm a little confused as to how this fixed the issue (I still think the filter code I checked in will cause a delay).

There should always be two values - just on the first update, the animator will be interpolating between the previous location and the new location, which will be the same as the previous location because we set it in that initial if block.

I think the animator will still wait 1 second in this scenario because of this code. Maybe forcing the updates just made it seem faster? Let me know if I'm not seeing something here. Thanks for running with this

@LukasPaczos
Copy link
Contributor Author

LukasPaczos commented Apr 17, 2018

That's a valid point. The PR fixes the issue but from a wrong angle. After retesting, I'm seeing that when the filtering is removed everything works as expected, otherwise the first location sample is dismissed and we need to either wait for a new one, or re-enter the activity which will use #setLastLocation and new timestamps will allow update to pass.
Do we even need

private boolean invalidUpdateInterval() {
return locationUpdateTimestamp > 0
&& (SystemClock.elapsedRealtime() - locationUpdateTimestamp) < ONE_SECOND;
}
after mapbox/mapbox-events-android#93 landed?

If not, I'd like to close this PR and open a new one removing the filtering. Let me know what you think @danesfeder.

@danesfeder
Copy link
Contributor

@LukasPaczos this should be good to close now with #431

@LukasPaczos
Copy link
Contributor Author

Looks like this PR is obsolete, following up in #431.

@LukasPaczos LukasPaczos deleted the 424-first-location-update branch April 17, 2018 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
location-layer-plugin Issues that deal with the location layer module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants