HERE SDK for Android (Premium Edition)
SDK for Android Developer's Guide

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.getExternalFilesDir(String), otherwise 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 mapFragment.init().

Note:
  • 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 MapEngine or AndroidXMapFragment.
  • Starting from Android 10 (see Scoped storage), disk cache path must be set under application-specific file directory.

Incompatibility with Older Versions

Starting from v3.4 HERE SDK is no longer compatible with pre-3.4 versions of the HERE SDK disk cache. Map data downloaded on pre-3.4 versions of HERE SDK cannot be used on v3.4 or later. This limitation can be avoided by upgrading the pre-3.4 cache using the DiskCacheUtility.migrate(String sourcePath, String destPath) method. This method takes the same path value as MapSettings.setDiskCacheRootPath(String), and it must be run before MapEngine is initialized for the first time.
Note: 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.