Here-api离线地图安装 [英] Here-api offline maps installation

查看:94
本文介绍了Here-api离线地图安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MapEngine初始化中,我想安装所有软件包,但是我被困在这里installMapPackages(List packageIdList),从哪里可以找到List packageIdList.

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

推荐答案

您应该使用MapLoader#getMapPackages() API检索根MapPackage对象.然后,您可以使用MapPackage#getId()方法找到您想要安装的国家/地区的ID.请注意,MapPackage对象不是直接从MapLoader#getMapPackages()调用返回的,而是通过侦听器对象返回的.您必须提供自己的MapLoader.Listener实现,并在调用getMapPackages()之前通过MapLoader#addListener(MapLoader.Listener listener)方法进行设置.

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().

例如:

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();

此处有更多详细信息:

  • 开发人员指南

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

  • API参考

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

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆