Map Disk Cache
HERE SDK allows you to set the map disk cache to another location such as an SD Card. Use
MapSettings.setDiskCacheRootPath(String path) to set desired cache location. This call should occur before
MapEngine initialization, otherwise default path will be used for disk cache. Default path for apps that have offline storage permission is
Context.getFilesDir(). For example, if you are modifying the application from the sample tutorial app, you can add the call in the
BasicMapActivity.java file before
- If you are using an SD card, ensure the SD card is always present to avoid any unexpected behavior.
- You should only delete the map data cache when the app is in its early start-up stages, before any HERE SDK calls. Otherwise, map data corruption and unexpected app errors can occur.
- If you plan to support changing the storage location such as switching between internal storage and an SD card, be aware that this requires an app restart, as the storage location switch must be done before initializing
- Starting from Android 10 (see Scoped storage), disk cache path must be set under application-specific file directory.
Incompatibility with Older Versions
DiskCacheUtility.migrate(String sourcePath, String destPath)method. This method takes the same
MapSettings.setDiskCacheRootPath(String), and it must be run before
MapEngineis initialized for the first time.
migrate(String, String)is marked as deprecated because it is offered temporarily to assist with the transition. It will be removed in a future release.