Android SDK v5 Migration Guide

On December 7th, 2022 we released the Mappedin Android SDK v5. This release focuses on improving the developer experience by making methods more accessible, simplifying complex methods, and reducing code required. This short migration guide explains the steps needed to migrate from version 4.

MPIMapView

labelAllLocations has been divided into two individual objects with their own methods.

Floating Labels

// Before
mapView.labelAllLocations(MPIOptions.FloatingLabelAllLocations())
// After
mapView.floatingLabelsManager.labelAllLocations(MPIOptions.FloatingLabelAllLocations())

Flat Labels

// Before
mapView.labelAllLocations(MPIOptions.FlatLabelAllLocations())
// After
mapView.flatLabelsManager.labelAllLocations(MPIOptions.FlatLabelAllLocations())

enableBlueDot has been deprecated in favor of MPIMapView.blueDotManager.enable.

disableBlueDot has been deprecated in favor of MPIMapView.blueDotManager.disable.

updatePosition has been deprecated in favor of MPIMapView.blueDotManager.updatePosition.

drawJourney has been deprecated in favor of MPIMapView.journeyManager.draw.

clearJourney has been deprecated in favor of MPIMapView.journeyManager.clear.

MPIMapViewListener

onBlueDotUpdated has been deprecated in favor of onBlueDotPositionUpdate and onBlueDotStateChange.

MPIMapViewManager

setPolygonColor has been updated:

  • The polygonID parameter has been changed to polygon, and now requires a polygon object (MPINavigatable.MPIPolygon) instead of a string.
  • The opacity parameter has been removed.
  • The textColor parameter has been removed.
mapView.setPolygonColor(polygon, "blue")

MPIWebData

OnBlueDotPositionUpdate has been deprecated in favor of OnBlueDotPositionUpdate and OnBlueDotStateChange.

Camera Controls

mapView.focusOn has been deprecated in favor of mapView.cameraManager.focusOn

// Before
mapView.focusOn(MPIOptions.Focus(polygons = listOf(polygon)))
// After
mapView.cameraManager.focusOn(targets = MPIOptions.CameraTargets(polygons = listOf(polygon)))

The callback of setRotation, setTilt, and setZoom now takes MPIError as a parameter.

Models

MPICameraControlsManager has been deprecated in favor of MPICameraManager.

MPIBlueDot has been deprecated in favor of MPIBlueDotPositionUpdate and MPIBlueDotStateChange.

The color attribute of the MPINavigatable.MPILocation class has been deprecated.

The map attribute of the MPINavigatable.MPIPolygon class is now of type MPIMap instead of String.

The map attribute of the MPINavigatable.MPINode class is now of type MPIMap instead of String.

The categories attribute of the MPINavigatable.MPILocation class is now of type List<MPICategory> instead of List<string>.

Events

The event BLUE_DOT_UPDATED has been deprecated in favor of BLUEDOT_POSITION_UPDATE and BLUEDOT_STATE_CHANGE instead.

Was this page helpful?