Onboard map management
Onboard map management
The MapManagementManager provides information about the currently installed map. Use this to retrieve map identifiers and track when maps were last updated.
Observing map information
Subscribe to receive updates about map information:
1import android.util.Log2import com.tomtom.automotive.integration.client.api.mapmanagement.MapInfo3import com.tomtom.automotive.integration.client.api.mapmanagement.MapInfoResponse4import com.tomtom.automotive.integration.client.api.mapmanagement.MapManagementManager5import com.tomtom.automotive.integration.client.api.mapmanagement.ObserveMapInfoListener6import com.tomtom.automotive.integration.client.common.Callback7import com.tomtom.automotive.integration.client.common.SdkReleasable89private val TAG = "MapManagement"10private var observeMapInfoReleasable: SdkReleasable? = null1112fun observeMapInfo(mapManagementManager: MapManagementManager) {13 observeMapInfoReleasable = mapManagementManager.observeMapInfo(14 object : ObserveMapInfoListener {15 override fun onMapInfo(mapInfoResponse: MapInfoResponse) {16 val mapInfo = mapInfoResponse.mapInfo17 if (mapInfo != null) {18 Log.d(TAG, "Map ID: ${mapInfo.id}")19 Log.d(TAG, "Last update: ${mapInfo.lastUpdateDateOfCurrentRegion}")20 } else {21 Log.w(TAG, "Map information unavailable")22 }23 }2425 override fun onFunctionalityUnavailable(reason: Callback.Reason) {26 Log.e(TAG, "Map info unavailable: ${reason.devMessage}")27 }28 }29 )30}3132fun unObserveMapInfo() {33 observeMapInfoReleasable?.release()34 observeMapInfoReleasable = null35}
MapInfo structure
The MapInfo object contains:
id- The identifier of the map. If multiple maps are installed, this string contains their identifiers separated by/(e.g.,45251/48988/49019)lastUpdateDateOfCurrentRegion- The most recent update timestamp of the current map region (asZonedDateTime?). Note that this is the time when the update was created, not when the region was installed on the device.