In MapEngine initialization I want to install all packages but I am stuck here installMapPackages(List packageIdList) from where can I find List packageIdList.
2 Answers
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

- 1,318
- 12
- 11
The only way (I think), is to recursively call getChildren() on MapPackage, then check getTitle() for each of the children package to find the region you need.
For example, to get the id of the "Bretagne" region in france, you need to go through rootMapPackage.getChildren().get(2/Europe/).getChildren().get(1/France/).getChildren().get(3/Bretagne/).getId()
Not very convenient. A method "search(String title)" on the root package would be handy.

- 789
- 6
- 17