Jump to content
Sign in to follow this  
deepgis

DIsplay a Map while Offline

Recommended Posts

Respected All,

I am learning online tutorials for webmapping using ArcGIS Runtime SDK for Android. I did all the steps according to the tutorial. I saved the .mmpk file on my sd card. But  my device doesn't recognize it. I am not programmer so I think I need to correct the file path in the code. Need help. I am using the same as written  below-

Add a new method to load the mmpk file into a Map object and then update your MapView to display it.

The file path used here may differ depending on how you loaded the file on your device. You may be required to alter the path to the file accordingly.

Loading the map package file is an asynchronous process because you do not want to block the device while the file loads.

If it fails to load the map package we fall back and show the online map.

 private void setupMobileMap() {
     if (mapView == null) {
         mapView = new MapView();
     }
     String mmpkFile = "devlabs-package.mmpk";
     final MobileMapPackage mapPackage = new MobileMapPackage(mmpkFile);
     mapPackage.addDoneLoadingListener(new Runnable() {
         @Override
         public void run() {
             // Verify the file loaded and there is at least one map
             if (mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0) {
                 mapView.setMap(mapPackage.getMaps().get(0));
             } else {
                 // Error if the mobile map package fails to load or there are no maps included in the package
                 setupMap();
             }
         }
     });
     mapPackage.loadAsync();
 }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.