private void javascriptCallback(String event, JSONObject arguments,
CallbackContext callbackContext) {
if (callbackContext == null) {
return;
}
JSONObject options = new JSONObject();
try {
options.putOpt("callback", event);
options.putOpt("arguments", arguments);
} catch (JSONException e) {
callbackContext.sendPluginResult(new PluginResult(
PluginResult.Status.JSON_EXCEPTION));
return;
}
PluginResult result = new PluginResult(Status.OK, options);
result.setKeepCallback(true);
callbackContext.sendPluginResult(result);
}
java类org.apache.cordova.PluginResult.Status的实例源码
TwilioVoicePlugin.java 文件源码
项目:twilio-voice-phonegap-plugin
阅读 27
收藏 0
点赞 0
评论 0
TwilioVoicePlugin.java 文件源码
项目:twilio-voice-phonegap-plugin
阅读 30
收藏 0
点赞 0
评论 0
public void onRequestPermissionResult(int requestCode, String[] permissions,
int[] grantResults) throws JSONException
{
for(int r:grantResults)
{
if(r == PackageManager.PERMISSION_DENIED)
{
mInitCallbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "Permission denied"));
return;
}
}
switch(requestCode)
{
case RECORD_AUDIO_REQ_CODE:
startGCMRegistration();
break;
}
}
SendingTask.java 文件源码
项目:PhoneChat
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void execute(String rawArgs, CallbackContext ctx) {
try {
String args = new JSONArray(rawArgs).getString(0);
Connection conn = _map.get(Integer.parseInt(args.substring(0, 8), 16));
if (conn != null) {
if (args.charAt(8) == '1') {
byte[] binary = Base64.decode(args.substring(args.indexOf(',') + 1), Base64.NO_WRAP);
conn.sendMessage(binary, 0, binary.length);
} else {
conn.sendMessage(args.substring(9));
}
} else {
}
} catch (Exception e) {
if (!ctx.isFinished()) {
PluginResult result = new PluginResult(Status.ERROR);
result.setKeepCallback(true);
ctx.sendPluginResult(result);
}
}
}
DisconnectionTask.java 文件源码
项目:PhoneChat
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void execute(String rawArgs, CallbackContext ctx) {
try {
JSONArray args = new JSONArray(rawArgs);
int id = Integer.parseInt(args.getString(0), 16);
int code = args.getInt(1);
String reason = args.getString(2);
Connection conn = _map.get(id);
if (conn != null) {
if (code > 0) {
conn.close(code, reason);
} else {
conn.close();
}
}
} catch (Exception e) {
if (!ctx.isFinished()) {
PluginResult result = new PluginResult(Status.ERROR);
result.setKeepCallback(true);
ctx.sendPluginResult(result);
}
}
}
SMSPlugin.java 文件源码
项目:plugnative-cordova-sms
阅读 25
收藏 0
点赞 0
评论 0
private PluginResult sendSMS(String Phone, String messages,String methods,CallbackContext callbackContext) {
String phoneNumber = Phone;
String message = messages;
String method = methods;
SmsSender smsSender=new SmsSender(this.cordova.getActivity());
if(method.equalsIgnoreCase("INTENT")){
smsSender.invokeSMSIntent(phoneNumber,message);
callbackContext.sendPluginResult(new PluginResult( PluginResult.Status.NO_RESULT));
} else{
smsSender.sendSMS(phoneNumber,message);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
// TODO Auto-generated method stub
return null;
}
IonicDeeplink.java 文件源码
项目:ionic-plugin-deeplinks
阅读 24
收藏 0
点赞 0
评论 0
private void getHardwareInfo(JSONArray args, final CallbackContext callbackContext) {
String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
JSONObject j = new JSONObject();
try {
j.put("uuid", uuid);
j.put("platform", this.getPlatform());
j.put("tz", this.getTimeZoneID());
j.put("tz_offset", this.getTimeZoneOffset());
j.put("os_version", this.getOSVersion());
j.put("sdk_version", this.getSDKVersion());
} catch(JSONException ex) {}
final PluginResult result = new PluginResult(PluginResult.Status.OK, j);
callbackContext.sendPluginResult(result);
}
ZeroConf.java 文件源码
项目:cordova-plugin-zeroconf
阅读 32
收藏 0
点赞 0
评论 0
public void sendCallback(String action, ServiceInfo service) {
CallbackContext callbackContext = callbacks.get(service.getType());
if (callbackContext == null) {
return;
}
JSONObject status = new JSONObject();
try {
status.put("action", action);
status.put("service", jsonifyService(service));
Log.d(TAG, "Sending result: " + status.toString());
PluginResult result = new PluginResult(PluginResult.Status.OK, status);
result.setKeepCallback(true);
callbackContext.sendPluginResult(result);
} catch (JSONException e) {
Log.e(TAG, e.getMessage(), e);
callbackContext.error("Error: " + e.getMessage());
}
}
UnityAdsPlugin.java 文件源码
项目:cordova-plugin-ad-unityads
阅读 23
收藏 0
点赞 0
评论 0
public void onFetchCompleted() {
Log.d(LOG_TAG, String.format("%s", "onFetchCompleted"));
PluginResult pr = new PluginResult(PluginResult.Status.OK, "onVideoAdLoaded");
pr.setKeepCallback(true);
callbackContextKeepCallback.sendPluginResult(pr);
//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
//pr.setKeepCallback(true);
//callbackContextKeepCallback.sendPluginResult(pr);
pr = new PluginResult(PluginResult.Status.OK, "onRewardedVideoAdLoaded");
pr.setKeepCallback(true);
callbackContextKeepCallback.sendPluginResult(pr);
//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
//pr.setKeepCallback(true);
//callbackContextKeepCallback.sendPluginResult(pr);
}
UnityAdsPlugin.java 文件源码
项目:cordova-plugin-ad-unityads
阅读 24
收藏 0
点赞 0
评论 0
public void onVideoCompleted(String itemKey, boolean skipped) {
Log.d(LOG_TAG, String.format("%s", "onVideoCompleted"));
if (!skipped) {
if (videoOrRewardedVideo == 1) {
}
else if (videoOrRewardedVideo == 2) {
PluginResult pr = new PluginResult(PluginResult.Status.OK, "onRewardedVideoAdCompleted");
pr.setKeepCallback(true);
callbackContextKeepCallback.sendPluginResult(pr);
//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
//pr.setKeepCallback(true);
//callbackContextKeepCallback.sendPluginResult(pr);
}
}
}
TIWifi.java 文件源码
项目:Cordova-Plugin-TI-WIFI
阅读 28
收藏 0
点赞 0
评论 0
@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
PluginResult result = null;
if (ACTION_GET_SSID.equals(action)) {
result = executeGetWifiInfo(args, callbackContext);
} else if (ACTION_START_CONFIG.equals(action)) {
result = executeStartConfig(args, callbackContext);
} else if (ACTION_STOP_CONFIG.equals(action)) {
result = executeStopConfig(args, callbackContext);
} else if (ACTION_START_FIND_DEVICE.equals(action)) {
result = executeStartFindDevice(args, callbackContext);
} else if (ACTION_STOP_FIND_DEVICE.equals(action)) {
result = executeStopFindDevice(args, callbackContext);
} else {
Log.d(LOG_TAG, String.format("Invalid action passed: %s", action));
result = new PluginResult(Status.INVALID_ACTION);
}
if(result != null) callbackContext.sendPluginResult( result );
return true;
}
InAppServicePlugin.java 文件源码
项目:atomic-plugins-inapps
阅读 29
收藏 0
点赞 0
评论 0
public void initialize(CordovaArgs args, final CallbackContext ctx) throws JSONException {
service.addPurchaseObserver(this);
service.init(new InAppService.InitCompletion() {
@Override
public void onInit(Error error) {
JSONObject data = new JSONObject();
try {
data.put("products", InAppServicePlugin.this.productsToJSON(service.getProducts()));
data.put("canPurchase", service.canPurchase());
if (error != null) {
data.put("error", errorToJSON(error));
}
}
catch (JSONException e) {
e.printStackTrace();
}
ctx.sendPluginResult(new PluginResult(Status.OK, data));
}
});
}
InAppServicePlugin.java 文件源码
项目:atomic-plugins-inapps
阅读 31
收藏 0
点赞 0
评论 0
public void fetchProducts(CordovaArgs args, final CallbackContext ctx) {
JSONArray array = args.optJSONArray(0);
if (array == null) {
ctx.sendPluginResult(new PluginResult(Status.INVALID_ACTION, "Invalid argument"));
return;
}
ArrayList<String> productIds = new ArrayList<String>();
for (int i = 0; i < array.length(); ++i) {
productIds.add(array.optString(i, "empty"));
}
service.fetchProducts(productIds, new InAppService.FetchCallback() {
@Override
public void onComplete(final List<InAppProduct> products, Error error) {
if (error != null) {
ctx.sendPluginResult(new PluginResult(Status.ERROR, errorToJSON(error)));
}
else {
ctx.sendPluginResult(new PluginResult(Status.OK, productsToJSON(products)));
}
}
});
}
InAppServicePlugin.java 文件源码
项目:atomic-plugins-inapps
阅读 27
收藏 0
点赞 0
评论 0
public void consume(CordovaArgs args, final CallbackContext ctx) {
String productId = args.optString(0);
if (productId == null) {
ctx.sendPluginResult(new PluginResult(Status.ERROR, "Invalid argument"));
return;
}
int quantity = args.optInt(1);
if (quantity < 1) {
quantity = 1;
}
service.consume(productId, quantity, new InAppService.ConsumeCallback() {
@Override
public void onComplete(int consumed, Error error) {
if (error != null) {
ctx.sendPluginResult(new PluginResult(Status.ERROR, errorToJSON(error)));
}
else {
ctx.sendPluginResult(new PluginResult(Status.OK, consumed));
}
}
});
}
InAppServicePlugin.java 文件源码
项目:atomic-plugins-inapps
阅读 26
收藏 0
点赞 0
评论 0
public void setValidationHandler(CordovaArgs args, final CallbackContext ctx) {
boolean noValidation = args.optBoolean(0);
if (noValidation) {
service.setValidationHandler(null);
return;
}
service.setValidationHandler(new InAppService.ValidationHandler() {
@Override
public void onValidate(String receipt, String productId, ValidationCompletion completion) {
int completionId = validationIndex++;
validationCompletions.put(completionId, completion);
JSONArray array = new JSONArray();
array.put(receipt);
array.put(productId);
array.put(completionId);
PluginResult result = new PluginResult(Status.OK, array);
result.setKeepCallback(true);
ctx.sendPluginResult(result);
}
});
}
MifarePlugin.java 文件源码
项目:cordova-mifare
阅读 27
收藏 0
点赞 0
评论 0
/**
* This is the main method for the MIFARE Plugin. All API calls go through
* here. This method determines the action, and executes the appropriate
* call.
*
* @param action The action that the plugin should execute.
* @param args The input parameters for the action.
* @param callbackContext The callback context.
* @return A PluginResult representing the result of the provided action. A
* status of INVALID_ACTION is returned if the action is not
* recognized.
*/
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
PluginResult result;
NxpLogUtils.enableLog();
NxpLogUtils.i(LOGTAG, "MIFARE Cordova plugin execute");
if (ACTION_INIT.equals(action)) {
result = init(args.getJSONObject(0), callbackContext);
} else if (ACTION_WRITE_TAG_DATA.equals(action)) {
result = writeTag(args.getJSONObject(0), callbackContext);
} else {
result = new PluginResult(Status.INVALID_ACTION);
}
if (result != null) {
callbackContext.sendPluginResult(result);
}
return true;
}
WifiAdmin.java 文件源码
项目:cordova-plugin-wifi
阅读 38
收藏 0
点赞 0
评论 0
private PluginResult executeEnableWifi(JSONArray inputs, CallbackContext callbackContext) {
Log.w(LOGTAG, "executeEnableWifi");
Context context = cordova.getActivity().getApplicationContext();
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
boolean toEnable = true;
try {
toEnable = inputs.getBoolean( 0 );
} catch (JSONException e) {
Log.w(LOGTAG, String.format("Got JSON Exception: %s", e.getMessage()));
return new PluginResult(Status.JSON_EXCEPTION);
}
wifiManager.setWifiEnabled( toEnable );
callbackContext.success();
return null;
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 22
收藏 0
点赞 0
评论 0
private boolean executeGetStatus(JSONArray inputs, CallbackContext callbackContext) {
String status = "0";
PayPal pp = PayPal.getInstance();
Log.i("mpl", "getStatus: after instance");
if( (pp != null) && pp.isLibraryInitialized() ) {
status = "1";
}
JSONObject json = new JSONObject();
try {
json.put("str", status);
} catch (JSONException e) {
}
callbackContext.sendPluginResult( new PluginResult(Status.OK, json) );
return true;
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 26
收藏 0
点赞 0
评论 0
public void onPaymentSucceeded(final String payKey, final String paymentStatus) {
Log.i(LOGTAG, "onPaymentSucceeded");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl("javascript:" +
"(function() {" +
"var e = document.createEvent('Events');" +
"e.initEvent('PaypalPaymentEvent.Success');" +
"e.payKey = '"+ payKey + "';" +
"e.paymentStatus = '"+ paymentStatus + "';" +
"document.dispatchEvent(e);" +
"})();");
}
});
this.payCallback.sendPluginResult( new PluginResult(Status.OK, paymentStatus) );
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 22
收藏 0
点赞 0
评论 0
public void onPaymentFailed(final String paymentStatus, final String correlationID,
final String payKey, final String errorID, final String errorMessage) {
Log.i(LOGTAG, "onPaymentFailed");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl( "javascript:" + "(function() {"
+ "var e = document.createEvent('Events');"
+ "e.initEvent('PaypalPaymentEvent.Failed');"
+ "e.payKey = '" + payKey + "';"
+ "e.paymentStatus = '" + paymentStatus + "';"
+ "e.correlationID = '" + correlationID + "';"
+ "e.errorID = '" + errorID + "';"
+ "e.errorMessage = '" + errorMessage + "';"
+ "document.dispatchEvent(e);" + "})();" );
}
});
this.payCallback.sendPluginResult(new PluginResult(Status.ERROR, errorMessage));
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 26
收藏 0
点赞 0
评论 0
public void onPaymentCanceled(final String paymentStatus) {
Log.i(LOGTAG, "onPaymentCanceled");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl( "javascript:" + "(function() {" +
"var e = document.createEvent('Events');" +
"e.initEvent('PaypalPaymentEvent.Canceled');" +
"e.paymentStatus = '"+ paymentStatus + "';" +
"document.dispatchEvent(e);" +
"})();");
}
});
this.payCallback.sendPluginResult(new PluginResult(Status.ERROR, paymentStatus));
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 25
收藏 0
点赞 0
评论 0
private boolean executeGetStatus(JSONArray inputs, CallbackContext callbackContext) {
String status = "0";
PayPal pp = PayPal.getInstance();
Log.i("mpl", "getStatus: after instance");
if( (pp != null) && pp.isLibraryInitialized() ) {
status = "1";
}
JSONObject json = new JSONObject();
try {
json.put("str", status);
} catch (JSONException e) {
}
callbackContext.sendPluginResult( new PluginResult(Status.OK, json) );
return true;
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 27
收藏 0
点赞 0
评论 0
public void onPaymentSucceeded(final String payKey, final String paymentStatus) {
Log.i(LOGTAG, "onPaymentSucceeded");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl("javascript:" +
"(function() {" +
"var e = document.createEvent('Events');" +
"e.initEvent('PaypalPaymentEvent.Success');" +
"e.payKey = '"+ payKey + "';" +
"e.paymentStatus = '"+ paymentStatus + "';" +
"document.dispatchEvent(e);" +
"})();");
}
});
this.payCallback.sendPluginResult( new PluginResult(Status.OK, paymentStatus) );
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 22
收藏 0
点赞 0
评论 0
public void onPaymentFailed(final String paymentStatus, final String correlationID,
final String payKey, final String errorID, final String errorMessage) {
Log.i(LOGTAG, "onPaymentFailed");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl( "javascript:" + "(function() {"
+ "var e = document.createEvent('Events');"
+ "e.initEvent('PaypalPaymentEvent.Failed');"
+ "e.payKey = '" + payKey + "';"
+ "e.paymentStatus = '" + paymentStatus + "';"
+ "e.correlationID = '" + correlationID + "';"
+ "e.errorID = '" + errorID + "';"
+ "e.errorMessage = '" + errorMessage + "';"
+ "document.dispatchEvent(e);" + "})();" );
}
});
this.payCallback.sendPluginResult(new PluginResult(Status.ERROR, errorMessage));
}
PayPalMPL.java 文件源码
项目:testpaypalmpl
阅读 22
收藏 0
点赞 0
评论 0
public void onPaymentCanceled(final String paymentStatus) {
Log.i(LOGTAG, "onPaymentCanceled");
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
PayPalMPL.thisPlugin.webView.loadUrl( "javascript:" + "(function() {" +
"var e = document.createEvent('Events');" +
"e.initEvent('PaypalPaymentEvent.Canceled');" +
"e.paymentStatus = '"+ paymentStatus + "';" +
"document.dispatchEvent(e);" +
"})();");
}
});
this.payCallback.sendPluginResult(new PluginResult(Status.ERROR, paymentStatus));
}
AmazonAds.java 文件源码
项目:cordova-amazon-ads
阅读 25
收藏 0
点赞 0
评论 0
/**
* This is the main method for the Amazon Ads plugin. All API calls go
* through here. This method determines the action, and executes the
* appropriate call.
*
* @param action
* The action that the plugin should execute.
* @param inputs
* The input parameters for the action.
* @param callbackContext
* The callback context.
* @return A PluginResult representing the result of the provided action. A
* status of INVALID_ACTION is returned if the action is not
* recognized.
*/
@Override
public boolean execute(String action, JSONArray inputs, CallbackContext callbackContext) throws JSONException {
PluginResult result = null;
if (ACTION_CREATE_INTERSTITIAL_AD.equals(action)) {
JSONObject options = inputs.optJSONObject(0);
result = executeCreateInterstitialAd(options, callbackContext);
} else if (ACTION_SHOW_INTERSTITIAL_AD.equals(action)) {
result = executeShowInterstitialAd(callbackContext);
} else {
result = new PluginResult(Status.INVALID_ACTION);
}
if (result != null)
callbackContext.sendPluginResult(result);
return true;
}
AmazonAds.java 文件源码
项目:cordova-amazon-ads
阅读 21
收藏 0
点赞 0
评论 0
private PluginResult executeShowInterstitialAd(final CallbackContext callbackContext) {
if (interstitialAd == null) {
return new PluginResult(Status.ERROR, "Interstitial Ad not available, call createInterstitialAd first.");
}
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (interstitialAd.showAd()) {
if (callbackContext != null) {
callbackContext.success();
}
} else {
if (callbackContext != null) {
callbackContext.error("Ad not showed");
}
}
}
});
return null;
}
GooglePlayServices.java 文件源码
项目:googleplayservices
阅读 35
收藏 0
点赞 0
评论 0
public void tryConnect (CallbackContext callbackContext) {
boolean isGpsAvailable = (GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity()) == ConnectionResult.SUCCESS);
if (!isGpsAvailable) {
callbackContext.sendPluginResult (new PluginResult (PluginResult.Status.OK, false));
return;
}
tryConnectCallback = callbackContext;
mGoogleApiClient = new GoogleApiClient.Builder (cordova.getActivity().getApplicationContext())
.addConnectionCallbacks (this)
.addOnConnectionFailedListener (this)
.addApi (Games.API)
.addScope (Games.SCOPE_GAMES)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_PROFILE)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build ();
mGoogleApiClient.connect ();
}
AdMob.java 文件源码
项目:litecoinEasyCheck
阅读 78
收藏 0
点赞 0
评论 0
/**
* 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.
*
* @param action The action that the plugin should execute.
* @param inputs The input parameters for the action.
* @param callbackId The callback ID. This is currently unused.
* @return A PluginResult representing the result of the provided action. A
* status of INVALID_ACTION is returned if the action is not recognized.
*/
@Override
public boolean execute(String action, JSONArray inputs, CallbackContext callbackContext) throws JSONException {
PluginResult result = null;
if (ACTION_CREATE_BANNER_VIEW.equals(action)) {
result = executeCreateBannerView(inputs);
} else if (ACTION_DESTROY_BANNER_VIEW.equals(action)) {
result = executeDestroyBannerView(inputs);
} else if (ACTION_REQUEST_AD.equals(action)) {
result = executeRequestAd(inputs);
} else if (ACTION_SHOW_AD.equals(action)) {
result = executeShowAd(inputs);
} else {
Log.d(LOGTAG, String.format("Invalid action passed: %s", action));
result = new PluginResult(Status.INVALID_ACTION);
}
callbackContext.sendPluginResult( result );
return true;
}
AdMob.java 文件源码
项目:litecoinEasyCheck
阅读 26
收藏 0
点赞 0
评论 0
/**
* Parses the create banner view input parameters and runs the create banner
* view action on the UI thread. If this request is successful, the developer
* should make the requestAd call to request an ad for the banner.
*
* @param inputs The JSONArray representing input parameters. This function
* expects the first object in the array to be a JSONObject with the
* input parameters.
* @return A PluginResult representing whether or not the banner was created
* successfully.
*/
private PluginResult executeCreateBannerView(JSONArray inputs) {
String publisherId;
String size;
// Get the input data.
try {
publisherId = inputs.getString( PUBLISHER_ID_ARG_INDEX );
size = inputs.getString( AD_SIZE_ARG_INDEX );
this.bannerAtTop = inputs.getBoolean( POSITION_AT_TOP_ARG_INDEX );
} catch (JSONException exception) {
Log.w(LOGTAG, String.format("Got JSON Exception: %s", exception.getMessage()));
return new PluginResult(Status.JSON_EXCEPTION);
}
// Create the AdView on the UI thread.
return executeRunnable(new CreateBannerViewRunnable(
publisherId, adSizeFromSize(size)));
}
AdMob.java 文件源码
项目:litecoinEasyCheck
阅读 29
收藏 0
点赞 0
评论 0
/**
* Parses the request ad input parameters and runs the request ad action on
* the UI thread.
*
* @param inputs The JSONArray representing input parameters. This function
* expects the first object in the array to be a JSONObject with the
* input parameters.
* @return A PluginResult representing whether or not an ad was requested
* succcessfully. Listen for onReceiveAd() and onFailedToReceiveAd()
* callbacks to see if an ad was successfully retrieved.
*/
private PluginResult executeRequestAd(JSONArray inputs) {
boolean isTesting;
JSONObject inputExtras;
// Get the input data.
try {
isTesting = inputs.getBoolean( IS_TESTING_ARG_INDEX );
inputExtras = inputs.getJSONObject( EXTRAS_ARG_INDEX );
} catch (JSONException exception) {
Log.w(LOGTAG, String.format("Got JSON Exception: %s", exception.getMessage()));
return new PluginResult(Status.JSON_EXCEPTION);
}
// Request an ad on the UI thread.
return executeRunnable(new RequestAdRunnable(isTesting, inputExtras));
}