How to load freshest streaming online map using HERE Navigate SDK

You might noticed there is a paragraph in release notes of each version of HERE SDK release, it indicated corresponding online (OCM) map version of this SDK version.

For example, SDK 4.22.0 is corresponding to online map v164 (and v84 for Japan); HERE SDK 4.21.0 is with online map v150.



You might want to know, how to load the freshest map data using SDK? Simply run this code snippet before SDKNativeEngine initialization. We create a function called getDefaultCatalogConfiguration, and specify latest online map version for SDK using CatalogVersionHint.latest(), for default OCM catalog and Japan catalog, as below:

<br />private List getDefaultCatalogConfiguration() { <br /> List catalogConfigurations = new ArrayList<>(); <br /> <br /> // We want to start with the latest catalog version. <br /> boolean ignoreCachedData = true; <br /> CatalogVersionHint versionHint = CatalogVersionHint.latest(ignoreCachedData); <br /> <br /> // An OCM catalog is required, typically, use your own catalog HRN here. <br /> String defaultOCMHRN = "hrn:here:data::olp-here:ocm"; <br /> DesiredCatalog defaultOCMCatalog = new DesiredCatalog(defaultOCMHRN, versionHint); <br /> catalogConfigurations.add(new CatalogConfiguration(defaultOCMCatalog)); <br /> <br /> // Specify a rich Japan map, requires special HERE credentials. <br /> // If the credentials are not enabled for access, the map falls back to the Japan base map. <br /> String japanOCMHRN = "hrn:here:data::olp-here:ocm-japan"; <br /> DesiredCatalog japanOCMCatalog = new DesiredCatalog(japanOCMHRN, versionHint); <br /> catalogConfigurations.add(new CatalogConfiguration(japanOCMCatalog)); <br /> <br /> return catalogConfigurations; <br />}<br />

Then, call this function.

<br />private void initializeHERESDK() { <br /> // Set your credentials for the HERE SDK. <br /> String accessKeyID = "HERE_ACCESS_KEY_ID"; <br /> String accessKeySecret = "HERE_ACCESS_KEY_SECRET"; <br /> AuthenticationMode authenticationMode = AuthenticationMode.withKeySecret(accessKeyID, accessKeySecret); <br /> SDKOptions options = new SDKOptions(authenticationMode); <br /> options.catalogConfigurations = getDefaultCatalogConfiguration(); //Load latest version of map <br /> <br /> try { <br /> Context context = this; <br /> SDKNativeEngine.makeSharedInstance(context, options); <br /> } catch (InstantiationErrorException e) { <br /> throw new RuntimeException("Initialization of HERE SDK failed: " + e.error.name()); <br /> } <br />} <br /> <br />As a result, legacy version of SDK can load freshest version now! <br /> <br />![](https://files.readme.io/c8cb48cf51afb72808f6f0623f14c653c2b5ed66198169a9a35088fd988e5f33-Pasted_image_3aecd976476d6a1045bf276c416d4395.png)<br />