Error Trying to Use ArcGISLocalTiledLayer

Discussion created by nashirak on Mar 24, 2014
Latest reply on Mar 25, 2014 by nashirak
I am having trouble using the ArcGISLocalTiledLayer.  I am using the latest 10.2.2 version of the ESRI SDK for Android.  I took code from the sample located  here  I am working on an application that will be disconnected from a network and needs to use its own internal maps.  For now, I thought I could use the "Export Tile Cache" sample to download maps (when the user is connected to the network), and then use the internal TPK file that is generated when off the network.  The code I took from the sample does generate a TPK file (which I will post), but when I initially try to use the file off network I get a:

EsriStatusException[code: -1001, Message:The ArcGISTiledMapServiceLayer cannot be initialized

Below is the code I am using to switch over to local during initialization:

public void onCreate(Bundle savedInstanceState) {

  mapURL = getResources().getString(R.string.streetMapUrl);
  defaultPath = this.getFilesDir().getAbsolutePath();
  defaultPath += DEFAULT_BASEMAP_PATH;
  File f = new File(defaultPath);
  String database = null;
   isLocalLayerVisible = true;
   database = f.getAbsolutePath();
  Intent parentIntent = getIntent();
        wgs84Ref = SpatialReference.create(SpatialReference.WKID_WGS84);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

        startLocation = new Point(parentIntent.getDoubleExtra("longitude", -80.649691), parentIntent.getDoubleExtra("latitude", 28.095114));
        dataFilterDistance = prefs.getInt(SettingsActivity.pk_culling_distance_m, 0);
  // Retrieve the map and initial extent from XML layout
  mMapView = (MapView)findViewById(;
  // Add dynamic layer to MapView
   onlineLayerId = mMapView.addLayer(new ArcGISTiledMapServiceLayer(""));
   localTiledLayer = new ArcGISLocalTiledLayer(database);
   localLayerId = mMapView.addLayer(localTiledLayer);
  mGraphLayer = new GraphicsLayer();
  graphicsLayerId = mMapView.addLayer(mGraphLayer);
   mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {
         private static final long serialVersionUID = 1L;
         public void onStatusChanged(Object source, STATUS status) {
          // This is done because the project isn't setup till afterword
                           // THIS IS WHERE I SEE THE ERROR
           if (OnStatusChangedListener.STATUS.INITIALIZED == status && source == mMapView) {
            int blackColor = Color.rgb(,
         SimpleLineSymbol line = new SimpleLineSymbol(blackColor,4.0f);
         Polyline circle = createCircle(startLocation.getX(),startLocation.getY(),dataFilterDistance);
         startLocation = convertToMap(startLocation);
         filterDistanceCircle = new Graphic(circle,line); 
         filterDistanceCircleUUID = mGraphLayer.addGraphic(filterDistanceCircle);
         startLocation = convertToDegrees(startLocation);
         mMapView.centerAndZoom(startLocation.getY(), startLocation.getX(), 13);

I have uploaded my TPK as a zip file.  It worries me that the error I get back is having to do with the "ArcGISTiledMapServiceLayer " which is what I am using for Remote maps.  I have verified that the code above does find the valid TPK file and skips past using my "ArcGISTiledMapServiceLayer" for online data and instantiates a "ArcGISLocalTiledLayer".

What am I doing wrong or missing?  Thanks in advance.