Mappedin Android SDK release notes are posted here and this page will be kept up-to-date as updates are released.
v3.0.7 - October 29, 2021
Update dependency in build.gradle to version 3.0.7: implementation 'com.mappedin.sdk:mappedin:3.0.7'
labelAllLocations
andlabelPolygon
now support legacy labelscreateMarker
support for nodes and coordinates- Methods to set minimum and maximum zoom levels with
setMinZoom
andsetMaxZoom
with the followingmapView.cameraControlsManager.setMinZoom(100)
v3.0.5 - August 24, 2021
Update dependency in build.gradle to version 3.0.5: implementation 'com.mappedin.sdk:mappedin:3.0.5'
- Bumped
minSdkVersion
to 21 (Android 5.0) - Security bug fixes
labelAllLocations
bug fix
August 16, 2021
Update dependency in build.gradle to version 3.0.4: implementation 'com.mappedin.sdk:mappedin:3.0.4'
- Performance improvements
v3.0.3 - July 22, 2021
Update dependency in build.gradle to version 3.0.3: implementation 'com.mappedin.sdk:mappedin:3.0.3'
- Label performance improvements: Some issues affecting the speed of rendering labels on the map have been fixed. This can lead to improved load times when rendering labels on map initialization, especially when smart labels are enabled.
v3.0.2 - June 24, 2021
Update dependency in build.gradle to version 3.0.2: implementation 'com.mappedin.sdk:mappedin:3.0.2'
Label rankings
Polygons now have a rank
property representing that polygon’s label display priority. This data is also accessible in the MPIData
object made available in onDataLoaded
.
fun onDataLoaded(data: MPIData) { val rankings: MPIRankings? = data.rankings val polygonRank = data.polygons.first().rank}
Label styling
Labels now have an appearance
property, a LabelAppearance
which controls the display of that label. New appearance options are available, and the previous style properties on the label itself are now considered deprecated.
val label = MPIOptions.Label( text="Hello", appearance=MPIOptions.LabelAppearance( margin=20.0, text=MPIOptions.LabelAppearance.Text( backgroundColor="#00ff00" ) ))
The following appearance options are available:
margin: Double,text: { numLines: Int, size: Double, maxWidth: Double, foregroundColor: String, backgroundColor: String},marker: { size: Double, foreGroundColor: { active: String, inactive: String }, backgroundColor: { active: String, inactive: String }}
Multi-destination navigation
The APIs to get directions and to draw a journey on the map now support multiple destinations, via the MPIDestinationSet
class. There is a new journeyManager
property on the mapView
with functions to draw
a journey, clear
the current journey, and setStep
on the current journey if it’s multi-destination. The drawJourney
and clearJourney
methods of mapView
are now considered deprecated.
val multiDirections: List<MPIDirections> = mapView.getDirections( to=MPIDestinationSet(listOf(aNode, anotherLocation)), from=aLocation) { ...}mapView.journeyManager.draw(multiDirections)
v3.0.1 - May 27, 2021
This release contains support for adjusting aspects of the camera that is used to render the mapView.
Android
Update to 3.0.1 production release: implementation 'com.mappedin.sdk:mappedin:3.0.1'
Camera controls
mapView
now contains another class, CameraControlsManager
, that allows the user to query and manipulate some aspects of the camera that is used to render the map. You can get and set the rotation and tilt of the camera:
mapView?.cameraControlsManager.setRotation(rotation: 180)
mapView?.cameraControlsManager.setTilt(tilt: 0.3)
mapView?.cameraControlsManager.rotation
mapView?.cameraControlsManager.tilt
Rotation is measured in degrees relative to north- setting it to 0 will orient the map so north points upward. Tilt is measured in radians relative to top-down- setting it to 0 will result in a top-down view, while setting it to 0.1 will apply a slight tilt.
v3.0.0-beta-11 - May 15, 2021
Android SDK 3.0.0-beta-11 release resolves a bug with the marker anchor where
regardless of passing any Anchor
using MPIOptions
, the pin stayed in the same location.
v3.0.0-beta-10 - April 26, 2021
This release contains support for custom blueDot color, error handling in mapView.showVenue
, no valid path for instructions in mapView.getDirections
and new blueDot callbacks.
Android
Update to 3.0.0-beta-10 in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-10'
Sample code examples can be found here for Android on GitHub
Custom Blue Dot Color
mapView.enableBlueDot
still takes in MPIOptions.BlueDot
as a parameter. MPIOptions.BlueDot
still takes in allowImplicitFloorLevel
, smoothing
, and showBearing
as before. In addition, you can now also pass in a string baseColor
in MPIOptions.BlueDot
that allows you to set the color of your blueDot. baseColor
supports strings like "red", "green", …, or colors in hex code such as "#7851a9". baseColor
is an optional parameter, and the default color is set to be the original blue dot color, "#2266ff".
mapView?.enableBlueDot(MPIOptions.BlueDot(allowImplicitFloorLevel: true, smoothing: false, showBearing: true, baseColor: "green"))
mapView?.enableBlueDot(MPIOptions.BlueDot(allowImplicitFloorLevel: true, smoothing: false, showBearing: true, baseColor: "#7851a9"))
MPIInstruction For No Valid Path
When calling mapView.getDirections
between two MPINavigatables
(MPINode, MPILocation, MPIPolygon) and there exists no valid path between them, the instruction
string of the first instruction in the directionsCallback
will state “No Valid Path Available” and the distance
double will contain 0.0.
Error Handling For ShowVenue
mapView.showVenue
still takes in a data string or a deserialized MPIVenueResponse
and MPIOptions.ShowVenue
as before. In addition, it has an optional error callback errorCallback
that allows you to check if mapView.showVenue
has an error. The error callback contains an MPIError
enum which is either null (no error), MPIError.SHOW_VENUE
(error showing the venue) or MPIError.DECODE
(error decoding the data). This error callback is optional, so nothing needs to be added if you do not want an error callback.
An example is shown below:
mapView.showVenue( "<venue data string>", MPIOptions.ShowVenue( labelAllLocationsOnInit = true, backgroundColor = "#CDCDCD" )) { it?.let { //error callback println(it?.errorMessage) }}
New Blue Dot Callbacks
BlueDot updates have now been split into two separate callbacks. Previously, the only callback was onBlueDotUpdated
and currently, the two callbacks are onBlueDotPositionUpdate
and onBlueDotStateChange
.
The onBlueDotPositionUpdate
callback takes in an MPIBlueDotPositionUpdate
parameter which is nearly identical to the MPIBlueDot
class, except MPIBlueDotPositionUpdate
contains a newly added Double?
variable bearing
. You can still expect the same behaviour for the other class variables in MPIBlueDotPositionUpdate
--- position (MPIPosition?
), map (MPIMap?
), nearestNode (MPINode?
).
The onBlueDotStateChange
callback takes in an MPIBlueDotStateChange
parameter which has four class variables --- name (MPIBlueDotState
), markerVisibility (MPIMarkerState?
), reason (MPIBlueDotStateReason?
), and message (String?
). These four variables introduce different properties about the current state of the blueDot. The enums have following possible values:
MPIMarkerState | MPIBlueDotState | MPIBlueDotStateReason |
---|---|---|
HIDDEN | NOT_LISTENING | OUTSIDE_MAP |
GHOST | LISTENING | NO_POSITIONS_PROVIDED |
NORMAL | HAS_POSITION | GEOLOCATION_PROVIDER_ERROR |
UNCERTAIN | HAS_INDOOR_POSITION | CUSTOM_GEOLOCATION_PROVIDER_ERROR |
LOCATION_UNCERTAIN |
Message is an optional string that is used for the WebSDK and basically adds additional non-enum messages to developers about why things may fail. But it is not relevant for the Android/iOS SDKs.
Changes you should make in your app to adopt the new blue dot event:
- You should add two additional callbacks (
onBlueDotPositionUpdate
andonBlueDotStateChange
) inside classes that conform toMPIMapViewListener
. MPIBlueDot
is now a deprecated class and should be replaced withMPIBlueDotPositionUpdate
.onBlueDotUpdated
is also a deprecated callback and should not be used. Instead, you should only use the callbacks explained above.- For everything you initially had in
onBlueDotUpdated
, you should also make your changes accordingly to include them inside the two new callbacks. The sample code includes an example of this: make the global variableblueDot
anMPIBlueDotPositionUpdate
, update the global variableblueDot
andnearestNode.text
insideonBlueDotPositionUpdate
instead.
v3.0.0-beta-9 - April 13, 2021
This release contains support for creating and removing custom markers, MPIOptions.Journey
has increased customization and distance
has been added as a property on MPIInstruction.MPIMap.createCoordinate
can be used to create a MPICoordinate
by passing in latitude and longitude values.
Android
Update to 3.0.0-beta-9 in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-9'
Sample code examples can be found here for Android on GitHub
Custom Markers
Markers can be created and removed using createMarker
and removeMarker
which are member functions of the MPIMapView
class. createMarker
takes in three parameters. Firstly, createMarker
takes in an MPINavigatable.MPINode
which the marker will be displayed on. Secondly, the function takes in a string of HTML code which will generate the appearance of the marker. Lastly, createMarker
takes in options in the form of an MPIOptions.Marker
object, which includes a rank (optional) and an anchor (optional). While rank is simply double, the anchor option is a MARKER_ANCHOR
enum and contains values for CENTER
, TOP
, BOTTOM
, LEFT
, and RIGHT. When createMarker
is called, the third parameter defaults to an empty MPIOptions.Marker
object. createMarker
returns a unique id string for the marker, which can later be used to remove the marker. Two code examples of creating a marker are as follows:
mapView.createMarker(polygon.entrances[0], "<div>marker1</div>")
id2 = mapView.createMarker(polygon.entrances[0], "<div>marker2</div>", MPIOptions.Marker(1.0, MPIOptions.MARKER_ANCHOR.LEFT))
removeMarker
takes in only the id of the marker to be removed. A code example of removing a marker is as follows:
mapView.removeMarker(id2)
Markers are also compatible with smartLabels and will replace labels when being generated. Additionally, once a marker is removed, the smartLabel will be displayed once again.
Update to drawJourney Options
mapView.drawJourney
still takes in an MPIDirections
object and MPIOptions.Journey
object as before. MPIOptions.Journey object can still take in a connectionTemplateString
and pathOptions
. In addition, you can now also pass in a destinationMarkerTemplateString
, departureMarkerTemplateString
, and polygonHighlightColor
to MPIOptions.Journey
. By default, when you call drawJourney
, a predetermined destination and departure marker appear on the last and first nodes, respectively, from MPIDirections.Path
. The same behaviour occurs if you pass null for both destinationMarkerTemplateString
and departureMarkerTemplateString
. You can also set destination and departure markers to not show up by passing in an empty string for both destinationMarkerTemplateString
and departureMarkerTemplateString
. If you want to create custom destination and departure markers, you can pass in your own custom string of HTML code. You can now also pass a polygonHighlightColor
string in MPIOptions.Journey
to change the highlighted color of the destination and departure polygons.
See the code block below some code examples for the features mentioned above:
mapView.drawJourney( directions = directions, options = MPIOptions.Journey( connectionTemplateString = "<div style=\"font-size: 13px;display: flex; align-items: center; justify-content: center;\"><div style=\"margin: 10px;\">{{capitalize type}} {{#if isEntering}}to{{else}}from{{/if}} {{toMapName}}</div><div style=\"width: 40px; height: 40px; border-radius: 50%;background: green;display: flex;align-items: center;margin: 5px;margin-left: 0px;justify-content: center;\"><svg height=\"16\" viewBox=\"0 0 36 36\" width=\"16\"><g fill=\"white\">{{{icon}}}</g></svg></div></div>", destinationMarkerTemplateString = null, departureMarkerTemplateString = "<div>departureMarker</div>", pathOptions = MPIOptions.Path( color = "#cdcdcd", pulseColor = "#000000", displayArrowsOnPath = true ), polygonHighlightColor = "orange" ))
Distance in Instructions
MPIInstruction
now contains a distance parameter which is the distance of the MPIAction
in meters.
Coordinate from Latitude/Longitude
To get the coordinate, createCoordinate
can be used. This function is a member of the MPIMap class. By passing in latitude and longitude values, createCoordinate returns an MPICoordinate object containing an x and y value, the latitude and longitude parameters, and the MPIMap itself. x and y values are scaled to Mappedin units & latitude and longitude represent real world units.
March 28, 2021
This release contains updates to display the venue by passing in data as MPIVenueResponse
or the string of the response from the legacy exporter service to the showVenue
method. Additionally, the type property on MPIVortex
has been changed to be an enum instead of a string.
Android
Update to 3.0.0-beta-8 in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-8'
ShowVenue
This is an alternative method to using loadVenue
where no API calls will be made to retrieve the data. Instead, the data must be passed into the showVenue method which takes in a data string or a deserialized MPIVenueResponse
and MPIOptions.ShowVenue
.
Sample code examples can be found here: GitHub
Reading MPIData from MPIVenueResponse
This response can be converted into an MPIData
object where Mappedin data can be read before displaying the venue by calling the static method fromVenueResponse on MPIData
and passing in the venue data string or MPIVenueResponse
Object.
val data = MPIData.Companion.fromVenueResponse(venueDataJson)
v3.0.0-beta-6 - February 28, 2021
This release contains updates on the bluedot by adding follow state, option to disable smoothing and showBearing, and a method for finding the nearest node based on screen coordinates.
Android
Update to 3.0.0-beta-6 in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-6'
Follow Mode
The MPIMapViewListener now has a new method called onStateChanged(:MPIState) that is triggered when the state of the map changes. Call mapView?.setState(MPIState.FOLLOW)
will set the map to follow the BlueDot (the screen will move to follow the bluedot and will change map to the correct floor. Map interactions will remove the user from this state (pan, zoom) and set the state to MPIState.EXPLORE
Bluedot Options
Pass showBearing
as true in MPIOptions.BlueDot
when calling enableBlueDot
to show bearing. Pass smoothing as false in MPIOptions.BlueDot
when calling enableBlueDot
to disable our smoothing algorithm.
Get Nearest Node By Screen Coordinates
Android Example to get nearest node from center of the screen (see full source code in GitHub)
mapView?.getNearestNodeByScreenCoordinates( mapView?.width?.div(2) ?: 0, mapView?.height?.div(2) ?: 0)
Bugfixes
focusOn can now properly focus on nodes passed in from locations
v3.0.0-beta-4 - February 15, 2021
This release contains updates to navigation, adds custom headers and options when showing the venue. To update, follow the instructions for each platform:
Data Changes
MPIDirections:
directions property has been renamed to instructions, please update this in your app if you are accessing the directions property.
Additionally, atVortex has been added to MPIInstruction, if a vortex is available at that instruction.
Android
Update to 3.0.0-beta-4 in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-4'
Update in your gradle file implementation 'com.mappedin.sdk:mappedin:3.0.0-beta-4'
Bluedot
To use bluedot, first enable it by calling enableBlueDot(), and then call updatePosition(:MPIPosition)
mapView.enableBlueDot()
//Call this whenever GPS or beacon location provider updates user position`mapView.updatePosition( MPIPosition( timestamp=0.0, MPIPosition.MPICoordinates( latitude=45.0, longitude=80.0, accuracy=3.0, floorLevel=null ), type="GPS" ))
Navigation w/ Connection Markers
You can now draw a journey instead of just a path with the drawJourney method which takes in an MPIDirections object. This will draw the path and connection markers if the journey is multi-floor.
mapView.getDirections(selectedPolygon!!, blueDot?.nearestNode!!, true) { directions -> directions?.path?.let { path -> mapView.drawJourney(directions) }}
To get text for directions, after calling getDirections with two MPINavigatables (MPINode, MPILocation, MPIPolygon) as the to and from parameters, you should receive an MPIDirections object in the callback. The instructions will be accessible in the instructions property which is a list of MPIInstructions which contains an instruction property which is a String that contains the text for the instruction.
Custom Navigation Markers
If you want custom navigation markers, you can pass in a connectionTemplateString in the MPIOptions.Journey. This is an html template, you can pass it in as seen below:
MPIOptions.Journey( connectionTemplateString = """ <div style=\"font-size: 13px;display: flex; align-items: center; justify-content: center;\"> <div style=\"margin: 10px;\"> {{capitalize type}} {{#if isEntering}}to{{else}}from{{/if}} {{toMapName}} </div> <div style=\"width: 40px; height: 40px; border-radius: 50%;background: green;display: flex;align-items: center;margin: 5px;margin-left: 0px;justify-content: center;\"> <svg height=\"16\" viewBox=\"0 0 36 36\" width=\"16\"> <g fill=\"white\">{{{icon}}}</g> </svg> </div> </div>""", pathOptions = MPIOptions.Path( drawDuration = 0.0, pulseIterations = 0.0 ))
You can use the template above and change the background color under background: green or pass in your own template string.
Custom Headers
Headers can now be added for each request when loading the venue
mapView.loadVenue(MPIOptions.Init(headers=listOf(MPIHeader("testName", "testValue"))))
Show Venue Options
You can also now pass in an MPIOptions.ShowVenue on loadVenue to modify the properties of the map on the first load, the following properties are supported firstMapId
, labelAllLocationsOnInit
, backgroundColor
, backgroundAlpha
mapView.loadVenue( MPIOptions.Init(venue="testVenue"), MPIOptions.ShowVenue( labelAllLocationsOnInit = false, firstMapId = "55e9c73fd982bc3839000003", backgroundColor = "#CDCDCD" ))