SDKOptions (API Reference)
Class SDKOptions
SDKOptions provide an alternative way to set or update the HERE SDK credentials and other
parameters at runtime to initialize the SDKNativeEngine.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionSpecifies action to perform when cache folder is locked by another process.Encapsulates Authentication method and parameters.booleanParameter to enable automatic cache updates.Internal to HERE SDK.Path to be used for caching purposes.longDesired upper bound of application size in bytes.This field specifies how theSDKNativeEngineshould access, use and store data for different catalogs.Set custom options for SDK Engines.Options that define custom behavior for the HERE SDK.Path used for storing application internal data, such as the offline search index and other essential data required for proper functionality.Defines a list of data features that can be enabled / disabled.booleanIf an application runs in a memory-constrained environment, enable this option to reduce the HERE SDK's memory footprint.Network settings to use at the start.booleanSets offline mode for the HERE SDK.Path to store persistent map data.Geopolitical view of a country, defined as a three letter country code by ISO 3166-1 alpha-3.Optional project ID to set the project scope of the login session. -
Constructor Summary
ConstructorsConstructorDescriptionSDKOptions(AuthenticationMode authenticationMode) Constructs a SDKOptions from authentication mode. -
Method Summary
-
Field Details
-
scope
Optional project ID to set the project scope of the login session. Not used if empty. see also Manage Projects and IAM Concepts
-
cachePath
Path to be used for caching purposes. It should be a path to the desired location where the application has read/write permissions. The path can be on internal or external storage. By default, this returns an empty string. Setting a new string, will overwrite the internally used default paths:
Context.getCacheDir().getPath(). If an absolute path is set, it will be used instead. If a relative path is set then directoryContext.getCacheDir().getPath()is used as parent path. Note, The cache path should be located under app-specific directory. Using shared directories such asDocumentsis not recommended as it will expose HERE SDK files to the other apps. It will also require additional permissions such asMANAGE_EXTERNAL_STORAGEand results in a poorer HERE SDK performance overall. The recommended location in terms of file I/O speed is the app's internal storage directory, whereas an external SD card is expected to be slower. This also depends on the quality of the used SD card. -
cacheSizeInBytes
public long cacheSizeInBytesDesired upper bound of application size in bytes. When cached data exceeds cache_size, least recently used data will be removed. Default value 256MB
-
dataPath
Path used for storing application internal data, such as the offline search index and other essential data required for proper functionality.
Note: For common use cases, prefer
persistentMapStoragePath, or keep the default paths. UsedataPathonly as a fallback ifpersistentMapStoragePathis not writable, for example, when you have an agreement with HERE to flash data at factory time.By default, this returns an empty string. In this case, the same path as
persistentMapStoragePathwill be used. If an absolute path is set, it will be used instead. If a relative path is set then directoryContext.getFilesDir().getPath()is used as parent path. Application must have read/write permissions to the given desired path. It is recommended that the application has exclusive access to this path. Avoid using shared or public directories such asDownloadorDocuments. Using such directories may cause certain HERE SDK features to behave with limitations. For example, index creation for offline search may fail or not function as expected. It is recommended not to use the application cache paths likeContext.getCacheDir().getPath(), since operating system manages data in this location and data can be deleted if the device is low on storage space, which will result in application malfunction. The path can be on internal or external storage. The internal storage is recommended due to the file I/O speed. Note: If thepersistentMapStoragePathis writable,dataPathcan be left empty. If thepersistentMapStoragePathis not writable,dataPathmust be set and also be writable. Note thatdataPathis used to store essential HERE SDK data.Important: There is no automatic migration of stored data between the
persistentMapStoragePathand thedataPath. For ease of management, it's recommended to set the persistence path as writable and ignoredataPath. IfdataPathis set differently from thepersistentMapStoragePath, some data that would typically be saved in thepersistentMapStoragePathwill now be saved todataPath. IfdataPathis set and later unset, any data stored there will remain inaccessible and will not be migrated back. -
persistentMapStoragePath
Path to store persistent map data. This should be the a path to the desired location for which the application has read/write permissions. The path can be on internal or external storage. By default, this returns an empty string. Setting a new string, will overwrite the internally used default paths:
Context.getFilesDir().getPath(). If an absolute path is set, it will be used instead. If a relative path is set then directoryContext.getFilesDir().getPath()is used as parent path. Note: Offline maps stored at<persistent_map_storage_path>/v1/<access_key_id>/ocm-map/, where<access_key_id>is taken fromSDKOptions.authenticationMode. WhenSDKOptionsinitialized withAuthenticationMode.withTokenorAuthenticationMode.withExternal, then<access_key_id>left empty.Note, persistent map storage path should be located under app-specific directory. Using shared directories such as
Documentsis not recommended as it will expose HERE SDK files to the other apps. It will also require additional permissions such asMANAGE_EXTERNAL_STORAGEand results in a poorer HERE SDK performance overall. Additionally, the Android MediaProvider imposes certain restrictions on the creation of non-media files (such as temporary files or database files), which may cause some functionality to not behave as expected. The recommended location in terms of file I/O speed is the app's internal storage directory, whereas an external SD card is expected to be slower. This also depends on the quality of the used SD card.Note: If the persistent map storage location has the read only permission, then the
dataPathmust be configured. -
politicalView
Geopolitical view of a country, defined as a three letter country code by ISO 3166-1 alpha-3. Each disputed territory has an international and an alternative geopolitical view. When set, the map view will show all country boundaries according to the geopolitical view of the country that has been set.
Note: Defaults to an empty string which enables the international view.
This is a beta feature and thus there can be bugs and unexpected behavior.
-
offlineMode
public boolean offlineModeSets offline mode for the HERE SDK. Defaults to
false. When enabled, this prevents the HERE SDK from initiating any online connection from starting. The mode can be disabled or enabled again at any time viaSDKNativeEngine.isOfflineMode(). -
layerConfiguration
Defines a list of data features that can be enabled / disabled. Once set to
SDKOptionswhen a new HERE SDK is constructed, it will affect the map cache and offline maps. When disabling certain features, less data will be prefetched when the map is rendered. Map data that was already cached will not be removed until the least recently used strategy (LRU) applies. That means you cannot remove any content from the map cache by updating theLayerConfiguration. However, for new map data, it will be applied. For offline maps, thisLayerConfigurationcan reduce the download size of all regions. Note that theLayerConfigurationis applied globally to all regions that will be downloaded in the future. It will not affect already downloaded regions. Updating a region will also not update theLayerConfiguration. Only theLayerConfigurationwill be used that was set globally when a region was downloaded for the first time. If you want to update theLayerConfigurationfor an already downloaded region, please delete the region and download it again.Please also note
- The
LayerConfigurationis only applicable for the HERE SDK (Navigate) that contains the offline maps feature. It has no effect on other licenses. - The
LayerConfigurationcannot be set separately for a region, it will be applied globally for all regions that will be downloaded in the future. - It is not possible to specify a separate
LayerConfigurationfor the map cache and offline maps. TheLayerConfigurationwill be always applied to both. - The
LayerConfigurationdoes affect the map cache when a device has connectivity. Even when a device has connectivity it will only download the specified layers. - This is a beta feature and thus there can be bugs and unexpected behavior.
- The
-
catalogConfigurations
This field specifies how the
SDKNativeEngineshould access, use and store data for different catalogs. You can access default catalogs on the HERE platform and also custom catalogs such as for self-hosted or BYOD (bring your own data) use cases. For further information about catalogs and related concepts seeCatalogConfigurationNote: This API is only available for the Navigate license. It has no affect on other license.
-
autoUpdateOfOnlineCache
public boolean autoUpdateOfOnlineCacheParameter to enable automatic cache updates.
When it is false, the cache will always use the same map version as offline maps. If offline maps are updated, the cache will be also updated. The cache version will never be older than the offline maps version.
When it is true, the cache will be automatically updated to use the latest map data that is available. In that case, the cache may contain map data that is newer than the offline maps data. Note that auto updates may also lead to increased network traffic, as the cached data will be evicted tile-by-tile before it is filled with newer map data. This process continues everytime the user views a new map view area until the data is replaced. Once also the offline map data is updated by the user, both map versions will be the same again.
If the value is also specified via the manifest (Android) or plist (iOS), than the value set via
SDKOptionswill overrule the value that was set in manifest/plist - until the current session ends and the value is read/set again.Note that offline maps are only available for the Navigate license.
Defaults to
false.Note: Do not use this yet, the behavior of this feature may be inconsistent. Once it will be usable, it will be announced in the regular HERE SDK release notes.
-
customEngineOptions
Set custom options for SDK Engines. This includes:
custom_base_url: Allows engines to use custom base URLs for alternative services. By default, the available endpoints use HERE backend endpoints. If unsupported base URLs are specified, the related features will become non-functional. Please contact your HERE representative to learn about possible custom base URL usage options.custom_authentication_mode: Enables bearer authentication mode for engines, which adds or omits the header ("Authorization", "Bearer $Token") to each online request made by the module the object is added to. The token (if used) can be provided directly or retrieved via key/secret from a dedicated backend. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
actionOnCacheLock
Specifies action to perform when cache folder is locked by another process. Default value is
SDKOptions.ActionOnCacheLock.WAIT_LOCKING_APP_FINISH. -
authenticationMode
Encapsulates Authentication method and parameters.
-
networkSettings
Network settings to use at the start. Some of those settings can be changed later.
-
lowMemoryMode
public boolean lowMemoryModeIf an application runs in a memory-constrained environment, enable this option to reduce the HERE SDK's memory footprint. When set to
trueconfigures internal memory caches to consume less memory. Reduction in cache sizes also reduces performance of the HERE SDK. In order to release memory occupied by internal caches seeSDKNativeEngine.purgeMemoryCaches(com.here.sdk.core.engine.SDKNativeEngine.PurgeMemoryStrategy). -
billingTag
Internal to HERE SDK. DO NOT USE THIS YET.
Warning: This is a placeholder and under developement. We will announce its availability in our changelog once it is ready for use.
A parameter to set a billing tag to track your HERE platform usage across the various HERE services your application may contact. For more information on the billing tag, see our cost management guide. The tag needs to follow the format as described in the guide or it will be ignored. The parameter defaults to
null, which also means that the tag is ignored for all requests.Note: The billing tag is optional, but when set, it can help you to understand how often your app uses certain services, for example, the number of hits to our HERE backend routing services. For more details on tracking such details, please consult the cost management guide or get in touch with the HERE billing team.
-
customOptions
Options that define custom behavior for the HERE SDK. These settings allow fine-tuning of internal thread pools and resource management for advanced use cases. These options are intended for internal usage only and should not be modified unless instructed by HERE support.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
-
Constructor Details
-
SDKOptions
Constructs a SDKOptions from authentication mode. Other fields are filled with default values.
- Parameters:
authenticationMode-Authentication Mode used for obtaining an access token.
-
-
Method Details