使用 Android 计费库在一笔交易中购买多个商品/多个商品数量

发布于 2025-01-13 21:07:49 字数 1441 浏览 3 评论 0原文

根据Android计费库v4.0+的文档,谷歌添加了购买多数量商品的功能。

我在 Play 管理中心启用了该选项: https://i.sstatic.net/OQ6OA.png

但不幸的是,对话框不会让我选择数量:

https://i.sstatic.net/OQEzA.png

调用代码如下所示:

        billingClient.querySkuDetailsAsync(params.build(),
                new SkuDetailsResponseListener() {
                    @Override
                    public void onSkuDetailsResponse(BillingResult billingResult,
                                                     List<SkuDetails> skuDetailsList) {
                        Log.d(TAG, "billingDebug: size" + skuDetailsList.size());

                        if (skuDetailsList.size() > 0){
                            BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
                                    .setSkuDetails(skuDetailsList.get(0))


                                    .build();
                            String responseCode = billingClient.launchBillingFlow(DetailActivity.this, billingFlowParams).toString();
                            Log.d(TAG, "billingDebug: response: " + responseCode);
                        }



                    }
        });

如何使用计费库购买多个 SKU/单个 SKU 的多个数量? 任何帮助将不胜感激。提前致谢。

According to the documentation of Android billing library v4.0+, google has added the ability to purchase multi-quantity of an item.

I enabled the option in Play Console:
https://i.sstatic.net/OQ6OA.png

But unfortunately the dialog won't allow me to select quantity:

https://i.sstatic.net/OQEzA.png

the invoking code looks like this:

        billingClient.querySkuDetailsAsync(params.build(),
                new SkuDetailsResponseListener() {
                    @Override
                    public void onSkuDetailsResponse(BillingResult billingResult,
                                                     List<SkuDetails> skuDetailsList) {
                        Log.d(TAG, "billingDebug: size" + skuDetailsList.size());

                        if (skuDetailsList.size() > 0){
                            BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
                                    .setSkuDetails(skuDetailsList.get(0))


                                    .build();
                            String responseCode = billingClient.launchBillingFlow(DetailActivity.this, billingFlowParams).toString();
                            Log.d(TAG, "billingDebug: response: " + responseCode);
                        }



                    }
        });

How can i use the billing library to purchase multiple SKUs / multi quantity of a single SKU?
Any help would be appreciated. Thanks in Advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一生独一 2025-01-20 21:07:49

无法手动设置数量。它由 Play 商店管理。用户可以在结帐时选择数量。

输入图片此处描述

There is no way to set the quantity manually. It is managed by Play Store. Users can select the quantity at checkout time.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文