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.Log
2import com.tomtom.automotive.integration.client.api.mapmanagement.MapInfo
3import com.tomtom.automotive.integration.client.api.mapmanagement.MapInfoResponse
4import com.tomtom.automotive.integration.client.api.mapmanagement.MapManagementManager
5import com.tomtom.automotive.integration.client.api.mapmanagement.ObserveMapInfoListener
6import com.tomtom.automotive.integration.client.common.Callback
7import com.tomtom.automotive.integration.client.common.SdkReleasable
8
9private val TAG = "MapManagement"
10private var observeMapInfoReleasable: SdkReleasable? = null
11
12fun observeMapInfo(mapManagementManager: MapManagementManager) {
13 observeMapInfoReleasable = mapManagementManager.observeMapInfo(
14 object : ObserveMapInfoListener {
15 override fun onMapInfo(mapInfoResponse: MapInfoResponse) {
16 val mapInfo = mapInfoResponse.mapInfo
17 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 }
24
25 override fun onFunctionalityUnavailable(reason: Callback.Reason) {
26 Log.e(TAG, "Map info unavailable: ${reason.devMessage}")
27 }
28 }
29 )
30}
31
32fun unObserveMapInfo() {
33 observeMapInfoReleasable?.release()
34 observeMapInfoReleasable = null
35}

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 (as ZonedDateTime?). Note that this is the time when the update was created, not when the region was installed on the device.