本文整理汇总了Java中org.apache.cordova.CordovaArgs.optBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java CordovaArgs.optBoolean方法的具体用法?Java CordovaArgs.optBoolean怎么用?Java CordovaArgs.optBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cordova.CordovaArgs
的用法示例。
在下文中一共展示了CordovaArgs.optBoolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValidationHandler
import org.apache.cordova.CordovaArgs; //导入方法依赖的package包/类
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);
}
});
}
示例2: validationCompletion
import org.apache.cordova.CordovaArgs; //导入方法依赖的package包/类
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);
}
}