Android Open Source - OpenGate Api Controller






From Project

Back to project page OpenGate.

License

The source code is released under:

Apache License

If you think the Android project OpenGate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.arquitetaweb.util;
//from   w w w.ja  v  a  2s  .com
import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;

public class ApiController {
  private Context context;

  public ApiController(Context context) {
    this.context = context;
  }

  public void sincronizar(String action) {
    new SincronizarDados().execute(action);
  }

  private class SincronizarDados extends AsyncTask<String, Void, Void> {

    @Override
    protected void onPreExecute() {
      super.onPreExecute();
    }

    @Override
    protected Void doInBackground(String... params) {
      return SincronizarConsumo(params[0]);
    }

    @Override
    protected void onPostExecute(Void result) {
      super.onPostExecute(result);
      Toast.makeText(context, "Enviado", Toast.LENGTH_LONG).show();
    }

    private Void SincronizarConsumo(String action) {
      GetApi api = new GetApi("192.168.10.20");
      // String retorno = api.getFromApi("tempo");
      api.getFromApi(action);
      return null;
    }
  }
}




Java Source Code List

com.arquitetaweb.opengate.OpenGateIntentReceiver.java
com.arquitetaweb.opengate.OpenGateProvider.java
com.arquitetaweb.util.ApiController.java
com.arquitetaweb.util.GetApi.java
com.arquitetaweb.util.OpenGateController.java