Alexander Makedonski February 2016

Here-api offline maps installation

In MapEngine initialization I want to install all packages but I am stuck here installMapPackages(List packageIdList) from where can I find List packageIdList.

Answers


HERE Developer Support February 2016

You should be able to get the List using the getMapPackages() method. Documentation link : https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/maps-offline.html


AndrewJC February 2016

You should use the MapLoader#getMapPackages() API to retrieve the root MapPackage object. You can then use the MapPackage#getId() method to find the Id's of the countries/regions you wish to install. Note that the MapPackage object is not returned directly from the MapLoader#getMapPackages() call, but instead through a Listener object. You must provide your own MapLoader.Listener implementation and set it by way of the MapLoader#addListener(MapLoader.Listener listener) method before calling getMapPackages().

For Example:

MapLoader.Listener mapLoaderListener = new MapLoader.Listener() {
  public void onUninstallMapPackagesComplete(MapPackage rootMapPackage,
     MapLoader.ResultCode mapLoaderResultCode) {
  }
  public void onProgress(int progressPercentage) {
  }
  public void onPerformMapDataUpdateComplete(MapPackage rootMapPackage,
     MapLoader.ResultCode mapLoaderResultCode) {
  }
  public void onInstallationSize(long diskSize, long networkSize) {
  }
  public void onInstallMapPackagesComplete(MapPackage rootMapPackage,
      MapLoader.ResultCode mapLoaderResultCode) {
  }
  public void onGetMapPackagesComplete(MapPackage rootMapPackage,
      MapLoader.ResultCode mapLoaderResultCode) {

      // This method will be called after MapLoader#getMapPackages()
      // is called
      // You can use the rootMapPackage object to find the Id's to
      // pass to installMapPackages()

  }
  public void onCheckForUpdateComplete(boolean updateAvailable,
    String currentMapVersion,String newestMapVersion,
          MapLoader.ResultCode mapLoaderResultCode) {
  }
};

MapLoader mapLoader = MapLoader.getInstance();

mapLoader.addListener(mapLoaderListener);
mapLoader.getMapPackages();

Further details here:

  • Developer Guide

Post Status

Asked in February 2016
Viewed 3,716 times
Voted 8
Answered 2 times

Search




Leave an answer