@Override public boolean execute(String action,JSONArray inputs,CallbackContext callbackContext) throws JSONException {
  PluginResult result=null;
  if (ACTION_SET_OPTIONS.equals(action)) {
    JSONObject options=inputs.optJSONObject(0);
    result=executeSetOptions(options,callbackContext);
  }
 else   if (ACTION_CREATE_BANNER_VIEW.equals(action)) {
    JSONObject options=inputs.optJSONObject(0);
    result=executeCreateBannerView(options,callbackContext);
  }
 else   if (ACTION_CREATE_INTERSTITIAL_VIEW.equals(action)) {
    JSONObject options=inputs.optJSONObject(0);
    result=executeCreateInterstitialView(options,callbackContext);
  }
 else   if (ACTION_DESTROY_BANNER_VIEW.equals(action)) {
    result=executeDestroyBannerView(callbackContext);
  }
 else   if (ACTION_REQUEST_INTERSTITIAL_AD.equals(action)) {
    JSONObject options=inputs.optJSONObject(0);
    result=executeRequestInterstitialAd(options,callbackContext);
  }
 else   if (ACTION_REQUEST_AD.equals(action)) {
    JSONObject options=inputs.optJSONObject(0);
    result=executeRequestAd(options,callbackContext);
  }
 else   if (ACTION_SHOW_AD.equals(action)) {
    boolean show=inputs.optBoolean(0);
    result=executeShowAd(show,callbackContext);
  }
 else   if (ACTION_SHOW_INTERSTITIAL_AD.equals(action)) {
    boolean show=inputs.optBoolean(0);
    result=executeShowInterstitialAd(show,callbackContext);
  }
 else {
    Log.d(LOGTAG,String.format("Invalid action passed: %s",action));
    result=new PluginResult(Status.INVALID_ACTION);
  }
  if (result != null) {
    callbackContext.sendPluginResult(result);
  }
  return true;
}

@ Override public boolean execute ( String action , JSONArray inputs , CallbackContext callbackContext ) throws JSONException { PluginResult result = null ; if ( ACTION_SET_OPTIONS . equals ( action ) ) { JSONObject options = inputs . optJSONObject ( 0 ) ; result = executeSetOptions ( options , callbackContext ) ; } else if ( ACTION_CREATE_BANNER_VIEW . equals ( action ) ) { JSONObject options = inputs . optJSONObject ( 0 ) ; result = executeCreateBannerView ( options , callbackContext ) ; } else if ( ACTION_CREATE_INTERSTITIAL_VIEW . equals ( action ) ) { JSONObject options = inputs . optJSONObject ( 0 ) ; result = executeCreateInterstitialView ( options , callbackContext ) ; } else if ( ACTION_DESTROY_BANNER_VIEW . equals ( action ) ) { result = executeDestroyBannerView ( callbackContext ) ; } else if ( ACTION_REQUEST_INTERSTITIAL_AD . equals ( action ) ) { JSONObject options = inputs . optJSONObject ( 0 ) ; result = executeRequestInterstitialAd ( options , callbackContext ) ; } else if ( ACTION_REQUEST_AD . equals ( action ) ) { JSONObject options = inputs . optJSONObject ( 0 ) ; result = executeRequestAd ( options , callbackContext ) ; } else if ( ACTION_SHOW_AD . equals ( action ) ) { boolean show = inputs . optBoolean ( 0 ) ; result = executeShowAd ( show , callbackContext ) ; } else if ( ACTION_SHOW_INTERSTITIAL_AD . equals ( action ) ) { boolean show = inputs . optBoolean ( 0 ) ; result = executeShowInterstitialAd ( show , callbackContext ) ; } else { Log . d ( LOGTAG , String . format ( "Invalid action passed: %s" , action ) ) ; result = new PluginResult ( Status . INVALID_ACTION ) ; } if ( result != null ) { callbackContext . sendPluginResult ( result ) ; } return true ; }
this is the main method for the admob plugin . all api calls go through here . this method determines the action , and executes the appropriate call .
