heremaps / here-sdk-examples

Android, iOS and Flutter example apps for the HERE SDK 4.x (Lite Edition, Explore Edition, Navigate Edition)
https://developer.here.com/products/here-sdk
Apache License 2.0
170 stars 135 forks source link

Change marker #314

Closed MauroGentile closed 5 months ago

MauroGentile commented 5 months ago

I want to use the visualNavigator and be able to switch from tracking mode to navigation mode. My understanding is that this is achieved by switching visualNavigator.route to null (tracking) to a specific route (navigation).

When switching, I also want to switch the Location indicator. To do so I do the following: in init, I create a LocatioIndicator like this

_locationIndicator = LocationIndicator();
_locationIndicator.isAccuracyVisualized = true;
_locationIndicator.locationIndicatorStyle = LocationIndicatorIndicatorStyle.pedestrian;
_locationIndicator.enable(hereMapController);
visualNavigator.customLocationIndicator = _locationIndicator;

When I want to switch to navigation:

_locationIndicator.locationIndicatorStyle = LocationIndicatorIndicatorStyle.navigation;
visualNavigator.customLocationIndicator = _locationIndicator;

When I want to go back to pedestrian, I call the following:

_locationIndicator.locationIndicatorStyle = LocationIndicatorIndicatorStyle.pedestrian;
visualNavigator.customLocationIndicator = _locationIndicator;

However the above seems not to have effect.... I always see the default indicator being displayed which, I understand, should automatically be disabled by assigning a no null LocationIndicator instance to visualNavigator.customLocationIndicator Is there anything I am doing wrong?

HERE-SDK-Support-Team commented 5 months ago

Hi @MauroGentile, in general, this assumption is correct. You can see an example of how to switch the LocationIndicator during guidance here.

However, note that the type of the LocationIndicator is taken from the route's TransportMode. It cannot be overriden during guidance. During tracking mode you can specify the marker type via:

_visualNavigator!.trackingTransportMode = TransportMode.pedestrian;

Hope this helps! Please leave a reply when you have more questions. Thanks!