Optimize the HERE SDK
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.
Use the Feature Configuration
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 AndroidManifest
, 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:
<meta-data
android:name="com.here.sdk.feature_configuration"
android:value="NAVIGATION, TRUCK" />
As of now, these features can be specified:
- "DETAIL_RENDERING": Additional rendering details like buildings. Only used for the
MapView
. - "NAVIGATION": Map data that is used for map matching during navigation. When not set, navigation may not work properly when being used offline.
- "OFFLINE_SEARCH": Map data that is used to search. When not set, the
OfflineSearchEngine
may not work properly when being used offline. - "OFFLINE_ROUTING": Map data that is used to calculate routes. When not set, the
OfflineRoutingEngine
may not work properly when being used offline. - "TRUCK": Map data that is used to calculate truck routes. When not set, the
OfflineRoutingEngine
may not work properly when being used offline 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.
Remove Unused Fonts
By removing unused fonts you can reduce the size of the HERE SDK. This is explained here.
Remove Unused Voices
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:
- Unzip the HERE SDK framework and search for the
voice_assets
folder. - If you want to shrink the size of the framework, you can 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.
More Options
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.