v1.0.2 - Documentation last updated on 29/04/2021
Localization Library is an optional Android library containing high level APIs.
It allows application developers to retrieve maps previously created using the Localization Setup application.
Add the dependency to your module’s build.gradle
file:
implementation 'com.aldebaran:qisdk-localization:1.0.2'
A Place represents a physical place. Each application can have 1 Place, or no Place.
A Place contains an ExplorationMap and a list of PointOfInterest. Each PointOfInterest has a name and a transform with respect to the mapFrame.
val place: Place? = Localization.requestPlace(qiContext)
// The Place is nullable, don't forget to null-check it.
if (place != null) {
val explorationMap: ExplorationMap = place.explorationMap
// Do something with the ExplorationMap.
} else {
// No Place found.
}
val place: Place? = Localization.requestPlace(qiContext)
// The Place is nullable, don't forget to null-check it.
if (place != null) {
val pointsOfInterest: List<PointOfInterest> = place.pointsOfInterest
pointsOfInterest.forEach { poi: PointOfInterest ->
Log.i("POI", "${poi.name} is at ${poi.transform}")
}
}
val place: Place? = Localization.requestPlace(qiContext)
// The Place is nullable, don't forget to null-check it.
if (place != null) {
// Build Localize action
val explorationMap = place.explorationMap
val localize = LocalizeBuilder.with(qiContext)
.withMap(explorationMap)
.build()
// Build the POI frames once localized
localize.addOnStatusChangedListener { status ->
if (status == LocalizationStatus.LOCALIZED) {
val mapFrame = qiContext.mapping.mapFrame()
place.pointsOfInterest.forEach {
val frame = mapFrame.makeAttachedFrame(it.transform).frame()
// Store or use the frame
}
}
}
// Run Localize action
localize.async().run()
}
Note: you can request the Place asynchronously using Localization.async().requestPlace(qiContext).