Skip to content

Fix issue #6360: Nearby: blue dot sometimes "jumps" back and forth between two places#6726

Open
Jason-Whitmore wants to merge 1 commit intocommons-app:mainfrom
Jason-Whitmore:issue_6360
Open

Fix issue #6360: Nearby: blue dot sometimes "jumps" back and forth between two places#6726
Jason-Whitmore wants to merge 1 commit intocommons-app:mainfrom
Jason-Whitmore:issue_6360

Conversation

@Jason-Whitmore
Copy link
Collaborator

Description (required)

Fixes #6360

What changes did you make and why?

This code change sets the lastLocationVar class variable in LocationServiceManager.kt to the new location when a medium location change occurs. This behavior is currently done with significant and slight location changes (as seen in the surrounding if statements).

Some of the calls to NearbyParentFragment.updateUserLocationOverlays() use the Location retrieved from LocationServiceManager's lastLocationVar class variable. Prior to this code change, this class variable was not being updated when a medium location change occurred. This would then cause the blue dot to be drawn at the wrong (old) location in some cases (which creates the appearance of the blue dot "jumping").

The change in this PR causes the blue dot to be drawn at the correct (new) Location retrieved from LocationServiceManager

Tests performed (required)

Tested ProdDebug on Android Studio emulator with API level 36.

Reproducing the bug and testing the bug fix (with either the Android Studio emulator or with a real device):

  1. Initiate a medium location change in Nearby. This (mostly) happens when the app receives a location update between 500 and 1000 meters from the previous best location estimate (assuming both locations estimates are reasonably accurate).

1.1. Android Studio emulator: With Nearby open and using the extended controls, move the emulated device's location to a new location between 500 and 1,000 meters from the starting location

1.2. Real device: With Nearby open, press the home button to pause/stop the activity. Then travel 500 to 1,000 meters away. Open the app and go to Nearby.

  1. Initiate a series of smaller location updates, preferably within 500 to 1,000 meters of the starting location. Make sure that the map is zoomed out enough to see both the new and old locations at the same time.

2.1. Android Studio emulator: In the extended controls, create a path from the new location and then simulate walking.

2.2. Real device: Begin walking with the Nearby activity open.

Following these steps on main reproduces the "jumping" blue dot which is drawn at the correct new user location and the incorrect old user location (see the original issue for an example).

On this PR branch, the blue dot is only drawn at the correct new user location.

…changes

Before this commit, when a medium location change occurred, the
LocationServiceManager would not set the location variable to the newest
Location. This would later cause the user's location overlay to be drawn
at an older and incorrect location.

This commit correctly sets the class's location variable to
the new location when a medium location change occurs. The user
location overlay is now drawn at this correct location.
@github-actions
Copy link

✅ Generated APK variants!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nearby: blue dot sometimes "jumps" back and forth between two places

1 participant