AnsweredAssumed Answered

Load mmpk file

Question asked by lgoubet on Nov 2, 2017
Latest reply on Nov 3, 2017 by lgoubet

Hi,

 

I use android 100.1.0 and I try to load a mmpk file in android.

I see my map but it is empty no layers visibled !!

What's the problem ?

I don't understand ...

 

// create the mobile map package
        mapPackage = new MobileMapPackage(mmpkFile);

 


        // add done listener which will invoke when mobile map package has loaded
        mapPackage.addDoneLoadingListener(new Runnable() {
            @Override
            public void run() {
                // check load status and that the mobile map package has maps
                if(mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0){

 

                    Log.e(TAG, "***************** SUCCESS CHARGEMENT MMPK ********************");
                    // add the map from the mobile map package to the MapView
                    ArcGISMap map = mapPackage.getMaps().get(0);
                    if (map != null){
                        _mapView.setMap(map);
                        map.addDoneLoadingListener(
                                () ->
                                {
                                    Log.e(TAG, "******************************** Carte chargée");
                                    map.getOperationalLayers().stream().forEach(layer -> {
                                        if (layer.getLoadStatus() != LoadStatus.LOADED && layer.getLoadStatus() != LoadStatus.LOADING)
                                            // On force le chargement de tous les layers
                                            layer.loadAsync();
                                            Log.e(TAG, "******************************** Chargement du layer " + layer.getName());

 

                                    });
                                }

 

                        );
                        map.loadAsync();

 

                 
                    }
                    else{

 

                    }
                }else{
                    // Log an issue if the mobile map package fails to load
                    Log.e(TAG, mapPackage.getLoadError().getMessage());
                }
            }
        });
        // load the mobile map package asynchronously
        mapPackage.loadAsync();

 

Thanks for you help

Outcomes