AnsweredAssumed Answered

Problem with Android Sync.

Question asked by mtw.nda@hotmail.com on Jan 9, 2015

Hello,I'm Trying to use the Sync Capabilitie with my android app.....

 

The app creates and enter in the connection created with server,generate the CreateGeoDatabaseParameters,run the submitTask But the App stuck at this process and not call the Error callback,Success callback or Status callback.....(i'm trying to use the DownloadDataProcess).

 

Someone Can help-me ???? Thanks.
there's the Code

 

 

 

 

private void runDownloadData(FeatureServiceInfo featureServerInfo) {


    // dialog = ProgressDialog.show(map.getContext(), "Download Data",
    // "Baixando os dados.");
    FRONTACTIVITY.setDialogSyncMessage("Baixando dados");
    GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters(featureServerInfo, Global.map.getMaxExtent(), Global.SPTRWMERCATOR);
    CallbackListener<String> gdbResponseCallback = new CallbackListener<String>() {
      @Override



      public void onError(final Throwable e) {
        Log.e(Global.TAG, "Erro ao Criar GeoDatabase : " + e);
        FRONTACTIVITY.invokeToast("Erro ao Criar o Geodatabase");
        layersSyncronized++;
        if (layersSyncronized < urls.size())
          getSyncDownload(urls.get(layersSyncronized));
        else {
          FRONTACTIVITY.dialogProgress.dismiss();
        }
      }


      @Override
      public void onCallback(String path) {
        Log.i(Global.TAG, "O local onde foi salvo o GeoDatabase  : " + path);
        layersSyncronized++;
        if (layersSyncronized < urls.size())
          getSyncDownload(urls.get(layersSyncronized));
        else {
          FRONTACTIVITY.dialogProgress.dismiss();
          FRONTACTIVITY.invokeToast("Sincronizacao Finalizada");
          addLayersFromLocalGDB(path);
        }
      }
    };


    GeodatabaseStatusCallback statusCallback = new GeodatabaseStatusCallback() {
      @Override
      public void statusUpdated(GeodatabaseStatusInfo status) {
        Log.i(Global.TAG, status.getStatus().toString());
        FRONTACTIVITY.invokeToast(status.toString());
      }
    };


    params.setInSpatialRef(Global.SPTRWMERCATOR);
    submitTask(params, Global.LOCALGDBFILEPATH, statusCallback, gdbResponseCallback);
  }


  private void submitTask(GenerateGeodatabaseParameters params, String file, GeodatabaseStatusCallback statusCallback, CallbackListener<String> gdbResponseCallback) {
    gdbSyncTask.generateGeodatabase(params, file, false, statusCallback, gdbResponseCallback);
  }

Outcomes