AnsweredAssumed Answered

Create a basemap from a tiled service (download a basemap) Example

Question asked by jaarons47 on Nov 13, 2013
Latest reply on May 5, 2014 by jaarons47
OK I am trying to use the example to build an offline tpk from a tiled service. 

https://developers.arcgis.com/en/android/guide/create-an-offline-map.htm#ESRI_SECTION1_286D33A9E13C4BFDA57428D9A0B88D22

There are not good examples so I am trying to follow the example from ArcGIS Runtime and adjust it to ArcGIS Runtime for Android.

https://developers.arcgis.com/en/java/sample-code/download-tile-cache-beta/

  The problem I appear to be having is on the CallbackListener. 

The line where the issue seems to be happening is  new CallbackListener<TileCacheStatus>() {
where I get the following error....

"java.io.FileNotFoundException: /1029171819/TileCacheStatus:


The code is below....  Any thoughts on what I am doing wrong here.


Envelope extent = new Envelope (-13656926.435,  5702260.809, -13655933.12,  5703167.369);
boolean createAsTilePackage = true;
        // fix this to 5 levels
        double[] levels = {0, 1, 2, 3, 4};
    
     GenerateTileCacheParameters params = new GenerateTileCacheParameters(
             createAsTilePackage,
             levels,
             ExportBy.ID,
             extent,
             mMapView.getSpatialReference());
tileCacheTask = new TileCacheTask("http://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Street_Map/MapServer", null);

tileCacheTask.submitTileCacheJobAndDownload(
               // parameters
               params,
               // status callback
               new CallbackListener<TileCacheStatus>() {
                 private boolean errored = false;
                
                 @Override
                 public void onError(Throwable e) {
                   errored = true;
                   //updateProgressBarUI(null, false);
                   e.printStackTrace();
                 }
                
                 @Override
                 public void onCallback(TileCacheStatus status) {
                   if (!errored) {
                    // updateProgressBarUI("Latest status: "+status.getStatus(), true);
                   }
                 }
               },
               // callback when download complete
               new CallbackListener<String>() {
                 private boolean errored = false;
          
                 @Override
                 public void onError(Throwable e) {
                   errored = true;
                  // updateProgressBarUI(null, false);
                   e.printStackTrace();
                 }
          
                 @Override
                 public void onCallback(String path) {
                   if (!errored) {
                    // updateProgressBarUI("Tile cache download complete. Switching to local layer...", true);
                    // switchToLocalLayer(path);
                    // updateProgressBarUI(null, false);
                     //tpkButton.setEnabled(true); // re-enable button for another job
                   }
                 }
               },
               // path for downloaded tile cache
               "file:///storage/extSdCard/Reference_Data/TPK/Test.tpk");

Outcomes