Jump to content

DIsplay a Map while Offline


deepgis

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

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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

Disable-Adblock.png

 

If you enjoy our contents, support us by Disable ads Blocker or add GIS-area to your ads blocker whitelist