Skip to content

Conversation

@kevinkreiser
Copy link
Contributor

@kevinkreiser kevinkreiser commented Oct 1, 2018

I've been testing with the sample app and have seen that the location updates using LocationEngine are coming in between every 2 and 3 seconds on average. In practice sometimes we get no location updates for much longer periods of time. Additionally when sitting still we dont get updates with the conventionally LocationEngine. This leads to a problem where we can't tell if we are sitting still or have no signal when navigating.

I've been able to take a sample application, fork it, and instrument it to see that indeed my device is capable of secondly gps updates (even when sitting still). This work is here: https://github.com/kevinkreiser/android-play-location/blob/master/LocationUpdates/app/src/main/java/com/google/android/gms/location/sample/locationupdates/MainActivity.java

@Guardiola31337 suggested that the fastest way for me to try this approach within the SDK was to simply write an AlternativeLocationEngine that extended the conventional one so that is what I did. So far the results are promising. As with the other test app, I am getting secondly updates.

@kevinkreiser kevinkreiser added the ⚠️ DO NOT MERGE PR should not be merged! label Oct 1, 2018
@danesfeder danesfeder changed the title an alternative location engine that provides more stable location updates Add FusedLocationEngine to Test App Oct 4, 2018
@danesfeder danesfeder force-pushed the kk_high_priority_gps branch from c374999 to c01ed05 Compare October 4, 2018 15:15
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.

@kevinkreiser added some cleanup here and updating naming / formatting. Good to go for the test-app for now. Thanks again for running with this 🚀

@danesfeder danesfeder force-pushed the kk_high_priority_gps branch from c01ed05 to c0c103e Compare October 4, 2018 15:49
@danesfeder danesfeder added ✓ ready for review and removed ⚠️ DO NOT MERGE PR should not be merged! labels Oct 4, 2018
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

You crushed it again @kevinkreiser 💪

I've left some minor comments. Also noticed that the camera in ComponentNavigationActivity isn't tracking anymore 👀

component_navigation_activity_no_camera_tracking

I've double checked and this is also reproducible in master. Is that working as designed @danesfeder? If not, we should cut a ticket to fix.

public void onPause() {
super.onPause();
mapView.onPause();
locationEngine.deactivate();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed. Actually, it's stopping the location engine when putting the app in the foreground.

Copy link
Contributor

Choose a reason for hiding this comment

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

For testing purposes I went ahead and fix ☝️ in 5978bd9 cc @kevinkreiser @danesfeder


private void createLocationRequest() {
locationRequest = new LocationRequest();
locationRequest.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

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

setInterval, setFastestInterval and setPriority are hardcoded. We should use set LocationEngine values instead.

private Location lastLocation = null;
private final ForwardingLocationCallback forwardingCallback = new ForwardingLocationCallback(this);

public FusedLocationEngine(@NonNull Activity activity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be this a Context instead?

@Guardiola31337
Copy link
Contributor

Also noticed that the camera in ComponentNavigationActivity isn't tracking anymore 👀

component_navigation_activity_no_camera_tracking

I've double checked and this is also reproducible in master. Is that working as designed @danesfeder? If not, we should cut a ticket to fix.

Found the "issue" thanks to @LukasPaczos. Latest changes in the LLP (mapbox/mapbox-plugins-android#544 (comment) and follow up PR mapbox/mapbox-plugins-android#583) + integrating them in the SDK (#1372, #1377 and #1386) introduced some camera gotchas https://www.mapbox.com/android-docs/plugins/overview/location-layer/#following-the-user-location-with-cameramode 👇

Traditional camera transitions will be canceled when any of the camera modes, besides CameraMode#NONE, are engaged. Use LocationLayerPlugin#zoomWhileTracking and LocationLayerPlugin#tiltWhileTracking to manipulate the camera in a tracking state. Use these two in combination with MapboxMap#CancelableCallback to schedule fluid transitions.

When instantiating the location layer plugin for the first time, the map's max/min zoom levels will be set to LocationLayerOptions#MAX_ZOOM_DEFAULT and LocationLayerOptions#MIN_ZOOM_DEFAULT respectively. Adjust the zoom range with the maxZoom() and minZoom() methods in the LocationLayerOptions class.

Going to open a PR that disables the camera tracking while not navigating.

Also, while debugging this I noticed that NavigationMapboxMap#updateCameraTrackingMode requests a @NavigationCamera.TrackingMode. Wouldn't be a good idea to request a @CameraMode.Mode instead - removing the necessity of having to implement @NavigationCamera.TrackingMode and the extra logic in NavigationCamera#setCameraMode from our side? Am I missing something? @danesfeder @LukasPaczos

@LukasPaczos
Copy link

The idea of exposing and requiring @NavigationCamera.TrackingMode instead of @CameraMode.Mode was to limit available camera mode options to those that are tested and well coordinated with the rest of the navigation UI/UX. Exposing the rest of camera tracking modes would generate another set of paths to maintain and wasn't in the scope of the original PR, but that's definitely an option we can explore going forward.

@Guardiola31337
Copy link
Contributor

Exposing the rest of camera tracking modes would generate another set of paths to maintain and wasn't in the scope of the original PR

Makes sense. Thanks for clarifying @LukasPaczos

but that's definitely an option we can explore going forward.

Yeah, let's revisit this in a follow up PR. It seems like we're duplicating logic unnecessarily. While testing OP I tried to set the camera mode to NONE and I wasn't able to. I know that we already have the updateCamerarTrackingEnabled API to achieve that but I guess we could use the options from LLP and remove that "duplicated" behavior. What do you think @danesfeder @LukasPaczos?

@LukasPaczos
Copy link

Adding the support for NONE sounds like a great first step to me.

kevinkreiser and others added 6 commits October 17, 2018 12:30
…igation-native version to kk_animate-SNAPSHOT-5 for testing
…ompared against the system clock for proper navigation/animation
…lue is compared against the system clock for proper navigation/animation"

This reverts commit 1a2781e.
…ompared against the system clock for proper navigation/animation
… request a context (instead of an activity) in fused location engine constructor
@Guardiola31337
Copy link
Contributor

Going to go ahead and merge here.

I opened a follow up ticket re. above camera mode discussion 👉 #1431

Thanks @kevinkreiser for running with this one 🙏

@Guardiola31337 Guardiola31337 merged commit 7637e4a into master Oct 17, 2018
@Guardiola31337 Guardiola31337 deleted the kk_high_priority_gps branch October 17, 2018 12:04
@danesfeder danesfeder mentioned this pull request Oct 24, 2018
11 tasks
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.

4 participants