Onboard map management
Request accessOnboard 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:
import android.util.Logimport com.tomtom.automotive.integration.client.api.mapmanagement.MapInfoimport com.tomtom.automotive.integration.client.api.mapmanagement.MapInfoResponseimport com.tomtom.automotive.integration.client.api.mapmanagement.MapManagementManagerimport com.tomtom.automotive.integration.client.api.mapmanagement.ObserveMapInfoListenerimport com.tomtom.automotive.integration.client.common.Callbackimport com.tomtom.automotive.integration.client.common.SdkReleasable
private val TAG = "MapManagement"private var observeMapInfoReleasable: SdkReleasable? = null
fun observeMapInfo(mapManagementManager: MapManagementManager) { observeMapInfoReleasable = mapManagementManager.observeMapInfo( object : ObserveMapInfoListener { override fun onMapInfo(mapInfoResponse: MapInfoResponse) { val mapInfo = mapInfoResponse.mapInfo if (mapInfo != null) { Log.d(TAG, "Map ID: ${mapInfo.id}") Log.d(TAG, "Last update: ${mapInfo.lastUpdateDateOfCurrentRegion}") } else { Log.w(TAG, "Map information unavailable") } }
override fun onFunctionalityUnavailable(reason: Callback.Reason) { Log.e(TAG, "Map info unavailable: ${reason.devMessage}") } } )}
fun unObserveMapInfo() { observeMapInfoReleasable?.release() observeMapInfoReleasable = null}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.