Customize map view

The default behavior of the Consumer SDK Map View is to auto-set bounds on the User's location and the Expected Place. This way, as the user moves closer to the Expected Place, the zoom level increases.

If your use-case requires a different behavior, you can use the following methods.

Show start location

The default behavior of the map fragment is to set the bounds with the user's location and the expected place. If you want the bounds to include start location as well, you need to enable the visibility of Source Marker by overriding showSourceMarkerForActionID method and then overriding disableDynamicZoom method of HyperTrackMapAdapter class.

With this, the start location will be visible in the bounds, along with the user's location and the expected place.

@Override
public boolean showSourceMarkerForActionID(HyperTrackMapFragment hyperTrackMapFragment, String actionID) {
  return true;
}

@Override
public boolean disableDynamicZoom(HyperTrackMapFragment hyperTrackMapFragment) {
  return false;
}

Custom Markers

Add Custom Marker

Call this method to add a Custom Marker to HyperTrackMapFragment.

htMapFragment.addCustomMarker(MarkerOptions markerOptions);

Pass instance of MarkerOptions defining the Marker properties. Refer to Google MarkerOptions documentation for more info.

Returns Marker instance added to HyperTrackMapFragment.

You can add as many as custom marker to HyperTrackMapFragment.

Remove Custom Marker

Call this method to remove a Custom Marker added to HyperTrackMapFragment

htMapFragment.removeCustomMarker(Marker marker);

Pass marker instance of Custom marker.

Returns true if the custom marker is removed, false if Map is null.

Clear all Custom Marker

Call this method to clear all custom markers from HyperTrackMapFragment

htMapFragment.clearCustomMarkers();

Returns true if all custom markers are removed, false if Map is null.

Get Custom Marker

Method to get Custom Marker for a given MarkerID added to HyperTrackMapFragment

htMapFragment.getCustomMarker(String markerID);

Pass Marker ID for the marker to be fetched.

Returns the custom marker for the given MarkerId if it exists, null otherwise.

Get All Custom Marker

Method to get a list of all Custom Marker added to HyperTrackMapFragment

htMapFragment.getAllCustomMarkers();

Returns a list of custom markers if they exist, null otherwise.

Auto-bounds for map

By default, the map view automatically re-focuses the map bounds as the location of the marker changes.

Disabling Map Auto-bounds

To disable auto-bounds, and keep the map bounds stationary when the marker moves, use the HyperTrackMapFragment's disableMapBounds method.

htMapFragment.disableMapBounds();

Reset Map Auto-bounds

To reset the map bounds to the default auto-bounds state, call HyperTrackMapFragment's resetMapBounds. If dynamicZoom is disabled, the source location will also be included in the map bounds.

htMapFragment.resetMapBounds();

[success] Customising bounds and zoom level

With this and the previous guide, you can customise the look and feel of the Consumer UI, to suit your use-case.

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""