InAppServicePlugin.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:atomic-plugins-inapps 作者:
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));
            }
        }
    });         
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号