简体   繁体   中英

Change offline maps directory to SD. HERE-Maps SDK

How can we change the directory to download the map. By default it is internal storage. But I need the user to select the download directory (device/SD).

I tried to use setIsolatedDiskCacheRootPath method. When I use SECONDARY_STORAGE path, SDK is not initialized. When I use EXTERNAL_STORAGE directory successfully changed, but this directory is located in the device memory ("/storage/emulated/0").

      com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(
                System.getenv("SECONDARY_STORAGE")+"/heremap"
                , "MyHereMapService");

Manifest:

    <service
        android:name="com.here.android.mpa.service.MapService"
        android:exported="true"
        android:label="MyHereMapService"
        android:process="global.Here.Map.Service.v2">
        <intent-filter>
            <action android:name="MyHereMapService" />
        </intent-filter>
    </service>

UPDATE: I was able to get the real path to SD. I use method ContextCompat.getExternalFilesDirs(activity, null), which return real path to SD card (secondary storage).

Summary: There is a possibility to change cache directory to sd. User choose ContextCompat.getExternalFilesDirs(activity, null) method, which return path to Secondary storage. Concerning the default here-map cache directory: There is no default directory if you are using the isolated disk cache API. It will cache to whatever folder you have specified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM