【问题标题】:how can i use consumePurchase method in in-app billing v3我如何在应用内结算 v3 中使用 consumePurchase 方法
【发布时间】:2019-09-13 02:32:15
【问题描述】:

我正在通过此链接使用应用内结算:https://github.com/anjlab/android-inapp-billing-v3 它只允许我一次购买该物品。所以我在谷歌上搜索了如何能够多次购买它,所有结果都导致我需要消费旧购买。我找不到调用消费函数的方式和方法 这是消费功能: billingProcess.consumePurchase(n_Selected)

我试图在 onCreate 方法中调用它:它没有做任何事情 我试图在 onProductPurchased 方法中调用它:它没有做任何事情

【问题讨论】:

    标签: java android-studio in-app-billing google-play-console


    【解决方案1】:

    您应该考虑使用 Google Play 的官方结算库。添加 com.android.billingclient:billing:2.0 到你的 build.gradle。

    https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive_v2 是 Google 的最佳做法。

    您应该始终在回调中调用 queryPurchases 并调用 consumeAsyc 来处理未完成的购买。另外,在onPurchasesUpdate方法中调用consumeAsyc,购买成功后触发。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多