问题描述
在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参考
这篇关于Here-api离线地图安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!