本文整理匯總了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);
}
}