Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
240 views
in Technique[技术] by (71.8m points)

android - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/maps-offline.html

  • API Reference

https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-odml-maploader.html

https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-odml-maploader-listener.html

https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-odml-mappackage.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...