This optimization guide lists several options to shrink the size of the HERE SDK and to optimize the runtime behavior by reducing the data that needs to loaded or processed.
With feature configurations you can specify how much map data should be loaded when panning the
MapView or when downloading a new
Region for offline usage. For example, if a feature like turn-by-turn navigation is never used in an application, it can be removed.
As a result, when panning the
MapView less data will be downloaded into the cache. In addition, when downloading a new
Region, its size will be smaller.
By default, all features are enabled. However, if a "FeatureConfiguration" is present in the
PList file, then only the listed features will be enabled, all others will be disabled. If you want to disable only one feature, then all other features need to be present, or they will be also disabled.
For example, the following enables only navigation and truck features and disables all others. On Android devices modify the
AndroidManifest file like so:
<meta-data android:name="com.here.sdk.feature_configuration" android:value="NAVIGATION, TRUCK" />
On iOS devices modify the
Plist file like so:
<key>FeatureConfiguration</key> <array> <string>NAVIGATION</string> <string>TRUCK</string> </array>
As of now, these features can be specified:
MapView. When not set, the data will be excluded when downloading offline regions or prefetching areas that contain such data. However, during online usage such data may still be downloaded into the cache and shown.
OfflineSearchEnginemay not work properly when being used.
OfflineRoutingEnginemay not work properly when being used.
OfflineRoutingEnginemay not work properly when being used to calculate truck routes. It is also used for map matching during truck navigation. When not set, truck navigation may not work properly when being used offline. Online truck navigation will still work when the device has an online connection.
landmarkslayer is set to be visible for a
MapScene, 3D landmarks will still be visible during online usage.
Feature configurations can be updated after the installation of the next application update by calling
mapUpdater.performFeatureUpdate(). Call this method once a feature configuration has been updated in the
As a result, the cached map data will be deleted and subsequently updated. Also, the downloaded regions will be updated to reflect the changes.
Note that it is the developer's responsibility to decide when to perform the update. The HERE SDK does not decide or notify when such an update can be made. Calling
performFeatureUpdate() is only necessary once - after an application has been updated. It is not necessary to call this, when the feature configuration has not been changed by a developer.
Engines like the
SearchEngine or the
RoutingEngine will never make use of cached or downloaded map data. Only the
OFflineRoutingEngine will use such data if the related features have not been disabled. For example, if you are sure that your app fully operates online, it is safe to disable the offline search feature. However, if you want to ensure that an app can also search for POIs when there is a temporary connection loss, you may want to switch to the
OfflineSearchEngine when such a loss is detected - and therefore, you should not disable the related feature.
As listed above, for some disabled features, a device may still download corresponding data when a device has online connectivity and the feature is needed. For example, when the "LANDMARKS_3D" feature is disabled, but the corresponding
MapScene layer is enabled, then the device will still download the needed textures to render a 3D landmark when it becomes visible in the
For all listed features from above - except for "OFFLINE_SEARCH" and "OFFLINE_ROUTING", the HERE SDK will first check if the needed data is available in the cache. If not found there, it will look if there is a downloaded
Region for offline use. If not found, the HERE SDK will try to download the needed data over the air. For "OFFLINE_SEARCH" and "OFFLINE_ROUTING" the behavior will be the same, but no data will be requested over the air.
By removing unused fonts you can reduce the size of the HERE SDK. This is explained here.
By removing unused voice guidance files you can reduce the size of the HERE SDK.
These files are only needed when you want to use turn-by-turn navigation with text-to-speech voice messages.
Do the following to remove the unused files.
heresdk.frameworkopen the folder
ios-arm64/voice_assetsand remove the voice packages you do not need.
Here you can find a list of all supported voice languages together with the name of the related voice skin that is stored inside the HERE SDK framework.
Other options to optimize the HERE SDK include:
In addition, all engines contain several options that allow how to configure a feature. For example, when using the
SearchEngine, you can specify
SearchOptions to limit the returned search results.