AnsweredAssumed Answered

Error adding dynamic map service with Android SDK 10.2.9

Question asked by suraj01 on Aug 30, 2018

I am stuck in loading dynamic map service using android sdk. The dynamic map service url can be loaded from javascript, and with android sdk 100.3. These sdks have feature to set map service id (setId()), which is not present in 10.2. With 10.2, I am only getting this status: 'ErrorCode: -1002 The ArcGISDynamicMapServiceLayer cannot be initialized'.

 

Can someone guide me on this error, and way to load dynamic map service in android 10.2 version? I need to load some raster images from arcgis workspace on this layer. 

 

Code:

 

ArcGISTiledMapServiceLayer baseMap = new ArcGISTiledMapServiceLayer(baseMapUrl);
mapView.addLayer(baseMap);

 

mapView.setOnStatusChangedListener(new OnStatusChangedListener() {

      private static final long serialVersionUID = 1L;

      

      @Override
      public void onStatusChanged(Object source, STATUS status) {
            if (source == mapView && status == STATUS.INITIALIZED) {
                  mapView.setExtent(envelope);
                  dynamicLayer = new ArcGISDynamicMapServiceLayer(dynamicUrl);
                  mapView.addLayer(dynamicLayer);

                  dynamicLayer.setOnStatusChangedListener(new OnStatusChangedListener() {

                        private static final long serialVersionUID = 2L;

                        

                        @Override
                        public void onStatusChanged(Object arg0, STATUS arg1) {
                              // At this point, we only get Dynamic layer initialization failed error
                              EsriErrorCode error = status.getError();
                              Log.e("Status ERROR!!", error.getDescription()); // ErrorCode: -1002 The                                                          //ArcGISDynamicMapServiceLayer cannot be initialized.
                           if (arg1 == STATUS.INITIALIZED) {
                              try {
                                 //load raster files
                              } catch (Exception ex) {
                                 ex.printStackTrace();
                                 Log.e("JSON error", ex.getMessage());
                              }
                     }
               }   
         });

   }

}

});

 

I need to use 10.2, as other features are implemented with this sdk version. Please help.

 

Thanks.

Outcomes