Cómo obtener tu contexto en tu plugin phonegap


Este es mi plugin para Android y uno de mis métodos requiere un contexto, ¿hay alguna manera de cómo puedo obtener este contexto?

public class GaziruPlugin extends CordovaPlugin{
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException 
{
    String value = args.getString(0);
    BASE64Decoder decoder = new BASE64Decoder();
    try {
        byte[] imageByte = decoder.decodeBuffer(value);
        Classlogic method = new Classlogic();
        //this method requires a context type.
        method.DoLogic(context,imageByte);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return false;
}

}

Espero que puedas ayudarme. Gracias

Author: Francis Cebu, 2014-08-31

1 answers

Intenta poner esto en tu plugin:

Context context=this.cordova.getActivity().getApplicationContext(); 
 79
Author: Martin Alcubierre Arenillas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-31 15:27:17