Java Code Examples for org.apache.cordova.CordovaArgs#optBoolean()
The following examples show how to use
org.apache.cordova.CordovaArgs#optBoolean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InAppServicePlugin.java From atomic-plugins-inapps with Mozilla Public License 2.0 | 6 votes |
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); } }); }
Example 2
Source File: InAppServicePlugin.java From atomic-plugins-inapps with Mozilla Public License 2.0 | 5 votes |
public void validationCompletion(CordovaArgs args, CallbackContext ctx) { int completionId = args.optInt(0); boolean validationResult = args.optBoolean(1); InAppService.ValidationCompletion completion = validationCompletions.get(completionId); if (completion != null) { Error error = null; if (!validationResult) { error = new Error(0, "Custom validation rejected purchase"); } completion.finishValidation(error); validationCompletions.remove(completionId); } }