Download Related Table with the feature service layers

2093
1
03-01-2016 05:23 AM
HaniDraidi
Occasional Contributor II

I have a feature service that include a layer with its related stand alone table, I use the following code to download the layer to my android device:

private void download() {

  // a- Create the GeodatabaseTask from URL

   // I- Define the Dialog

  dialog2 = ProgressDialog.show(mMapView.getContext(),

  "Download Data", "Downloading data to your local device");

  dialog2.setCanceledOnTouchOutside(true);

  dialog2.show();

  

   // II- Create the GDB Task

  gdbsync= new GeodatabaseSyncTask(url, null);

  gdbsync.fetchFeatureServiceInfo(new CallbackListener<FeatureServiceInfo>() {

  public void onError(Throwable e) {

  // TODO Auto-generated method stub

  showToast("Unable to get service information! Please Check Internet Connection");

  dialog2.dismiss();

  }

  public void onCallback(FeatureServiceInfo objs) {

  // TODO Auto-generated method stub

  if(objs.isSyncEnabled()){

  creategdb(objs);

  }

  }

  private void creategdb(FeatureServiceInfo objs) {

  // TODO Auto-generated method stub

  /*GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters

  (objs, mMapView.getExtent(), mMapView.getSpatialReference());*/

  GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters(objs.getLayerIds(), mMapView.getExtent(),mMapView.getSpatialReference(), false, SyncModel.GEODATABASE);

  //GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters(objs);

  // Define a callback that is triggered when the task is finished

  CallbackListener<String> gdbresponse = new CallbackListener<String>() {

  public void onError(Throwable e) {

  // TODO Auto-generated method stub

  dialog2.dismiss();

  //showToast("An Error Happened while downloading the data!");

  showToast(e.getCause().toString());

  }

  public void onCallback(String objs) {

  // TODO Auto-generated method stub

  updatefeaturelayer(path);

  dialog2.dismiss();

  }

  };

  GeodatabaseStatusCallback statuscallback =new GeodatabaseStatusCallback() {

  public void statusUpdated(GeodatabaseStatusInfo status) {

  // TODO Auto-generated method stub

  }

  };

  submit(params,path,statuscallback,gdbresponse);

  }

  });

  }

However, the layer's data is only downloaded without the related stand alone table.

How can I download the related table along with the layer?

0 Kudos
1 Reply
WillCrick
Occasional Contributor

See the reply to this post: Download Related Table

0 Kudos