Migration from V6 to V8¶
The major APIs’ differences between Pointr V6 SDK and V8 SDK are related to the User Interface classes. The Map Widget and all related classes have been the most affected since now the SDK has Pointr’s latest 3D maps technology with new UI components for most of the mobile features. The managers based structure is mostly the same except for the removal of MapManager, the renaming of the terms venue and facility and other minor changes.
List of Changes¶
Venue and Facility types¶
Venue and facility terms have been renamed to Site and Building across the entire SDK. This includes, class names, protocols, properties and methods.
Examples of classes and Protocols¶
SDK v6 | SDK v8 |
---|---|
Venue | Site |
Facility | Building |
VenueFacilityManager | SiteManager |
VenueFacilityManager.Listener | SiteManager.Listener |
Examples of properties (across several classes)¶
SDK v6 | SDK v8 |
---|---|
venue | site |
venues | sites |
facility | building |
facilities | buildings |
Examples of Methods¶
SDK v6 | SDK v8 |
---|---|
onVenueFacilityManagerDataChanged | onSiteManagerDataChanged |
venueExternalIdentifier | siteExternalIdentifier |
Changes in PTRMapWidgetFragment API¶
- showPoiDetails(poi: Poi) -> Allows third party integrators to show POI details view of the given Poi.
- showPathFinding(pathSession: PathSession) -> Allows third party integrators to start a path session within the context of Pointr Maps. To learn more about creating PathSession’s please refer to the Pathfinding section of our Doc center.
- showRouteSummary(destination: Poi) -> Allows third party integrators to show the route summary view of the given poi. This shows a view that includes the distance, estimated time, and the route steps to arrive to the given Poi.
Changes in PTRMapFragment API¶
- fun rotateToDirection(direction: Double, isAnimated: Boolean)
- direction: The heading of the map, measured in degrees clockwise from true north
- isAnimated: Flag to determine changing should be animated or not.
- resetNorth() -> This method resets the orientation back to the northern heading with animation. This is for when the map is in Rotational mode. Please refer to the Map Modes section of our doc center.
- All the methods regarding MapDrawables are removed.
- All the methods related to MapTrackingModes are removed. Now the operations related to MapModes should be handled using the ptrMapWidget.trackingModeHandler
Changes in MapDrawables¶
- The concept of MapDrawable, MapDrawableSupplier, MapDrawableViewSupplier are all removed. For V8 the map already contains all the necessary annotations (all pois added to Pointr Cloud), so it’s not necessary to manage it in your implementation. As a result, the icons for the annotations cannot be changed from the app side. You will be able to get your designs to the Pointr team, and we will update our 3D maps accordingly.
Custom Annotations¶
In case you still want to add your own annotations to the map, instead of using MapDrawableSupplier
and MapDrawableViewSupplier
as in v6, you use the addAnnotation
and removeAnnotation
methods on the map activity.
The data specific to each annotation, like location and title, is set on PTRMapViewMarker
class, and the data related to appearance is defined on a class named PTRMapViewAnnotationLayer
. Annotations with the same appearance should be added to the same layer.
Example for v8:¶
Kotlin Code:
val annotation = PTRMapViewMarker("marker id",
latitude = latitude,
longitude = longitude,
color = R.color.black,
icon = ContextCompat.getDrawable(mapActivity,R.drawable.mark),
shouldAllowOverlap = true)
val annotationLayer = PTRMapViewAnnotationLayer("layer-id",R.color.black,"layer",ContextCompat.getDrawable(mapActivity,R.drawable.mark))
Note : `layer' is a optional field
mapActivity.widget.addAnnotation(annotation,selectedLevel,layer)
mapActivity.widget.addAnnotation(annotation,selectedLevel)
Location¶
The local coordinate system has been removed, which means the properties x and y are no longer available. The only available coordinates are now the geo coordinates, latitude and longitude, that can be accessed through the coordinate property.
Other classes no longer descend from Location
, like Poi
. Instead, these classes now have a property named location
. Example:
SDK v6 | SDK v8 |
---|---|
poi.lat | poi.location.lat |
Methods that used to have arguments of type Location
, have changed to LocationAware
type. LocationAware
is now the super class of classes like Poi
. This means that passing a Poi
object in these cases will still be valid, as well as passing Location
objects.
Changes in classes and Directories¶
-
PTRMapCanvas is removed, now only PTRMapWidgetFragment and PTRMapFragment is used. The methods that were available on PTRMapCanvas like scrolling & zooming are now available in PTRMapFragment
-
PTRMapFragment resides in a different directory now(com.pointrlabs.core.map.views), but is accessible through PTRMapWidgetFragment as it was on V6
Changes in Zoom & Scroll¶
-
Changing the zoom level api has changed. It is now done from PTRMapFragment with the following method:
- setZoomLevel(zoomLevel: Double, isAnimated: Boolean) -> Zooms the camera with desired zoom level.
- parameter zoomLevel: Desired Zoom Level
- parameter isAnimated: Flag to determine if zooming should be animated or not
- setZoomLevel(zoomLevel: Double, isAnimated: Boolean) -> Zooms the camera with desired zoom level.
-
zoomTo(location: Location) method from MapFragment has turned to zoomToLocation(location: GeoPoint) in PTRMapFragment, which zooms in LocationTrackingZoomLevel amount. If you want to have a custom zoom level and scroll to a location, please use scrollToLocation(location: GeoPoint, zoomLevel: Double) function. Or if you only want to scroll and not change zoom level, please use scrollToLocation(location: GeoPoint)
Building configuration¶
FacilityConfiguration
class has been removed on v8. All data related to the building’s geometry like geo coordinates of the corners, center, etc, can be accessed directly on Building
objects.
Example to get north latitude:
Kotlin Code:
val northLatitude = building.boundingBox.northLatitude
Example to get center:
Kotlin Code:
val centerCoordinate = building.geometry.enclosingCircle.center
Changes in Listener & Handler Logic/API¶
- PTRMapFragmentListener is removed. It is updated to MapEventsListener. You can implement this interface and add it as a listener to PTRMapWidgetFragment instance with the addListener method. Some of the callbacks here were renamed.
- onMapSingleTapped -> mapDidReceiveTap
- onMapChanged -> mapDidChangeLevel
- onMapTrackingModeChangedTo -> mapDidChangeTrackingMode
- onPoiDetailViewEvent -> moved to PoiDetailsEventsListener
- onScroll -> moved to TrackingModeEventsListener
- onRouteHeaderViewEvent -> moved to RouteSummaryEventsListener
- (removed)onZoom
- (added) mapDidStartLoading
- (added) mapDidEndLoading
- (added) mapDidFailToLoad
- (added) mapDidReceiveTapOnPoi (removed from MapDrawableEventHandler)
- (added) mapDidUpdateStyle
- Now you can add any listener from the list below directly to PTRMapWidgetFragment class, with the addListener method. Please refer to the javadoc of these interfaces to get an understanding of the methods available and their comments.
- SearchEventsListener : Listen to events regarding the search bottom sheet. Like a POI click from the search list.
- PoiDetailsEventsListener : Listen to events regarding the POI Details View Bottom sheet, which is shown after a POI click. So events like Navigate, Show action can be listened to here.
- RouteSummaryEventsListener : Listen to events regarding the Route Summary view, which is shown after the user selects to navigate to a Poi. The action of the user is notified to these listeners, either Dismiss or Navigate
- LevelSelectorEventsListener : Listen to the events from the Level Selector. Like LevelSelector clicked, or like user clicked on a level.
- PathfindingEventsListener : Listen to when pathfinding is closed manually by user
- PathUpdatesEventsListener : Listen to path updates, callbacks will be triggered when there is an active path session
- MapEventsListener : Listen to Map events, like tap on map, tap on Poi, level change etc.
- ExitButtonEventsListener : Listen to events regarding the action on the exit button.
- LocationUpdatesEventsListener : Listen to location updates, or level changes by user position, or map tracking mode change
- TrackingModeEventsListener : Listen to events regarding tracking mode changes and actions affecting tracking modes, like map scroll, POI highlight, map rotation, etc.
- ArEventsListener : Notifies listeners when AR button is clicked
- Setting custom handlers are converted to property setters. On V6 they were assigned with ptrMapWidget.setHandler(customHandler) method, but with V8, they are set with property access syntax like ptrMapWidget.handler = customHandler.
- The handler logic remains the same. They are concrete classes which implement the Listener interfaces listed above, and default behavior upon these events. To give an example, let’s say a user wants to override the behavior upon level selection, they can write a custom handler that implements the LevelSelectorEventsHandler, and override the ‘onLevelSelected’ method. They can call super to keep the default behavior and augment it or if they do not want the default behavior they can remove the super call and add their custom behavior.
Note
Below permissions are added to Pointr SDK AndroidManifest, but they require no action from you;
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/>
Also, you can remove these from your project’s AndroidManifest file if you do not use Pointr as a foreground service.