Android - BillingClient 返回空的购买列表

Ano*_*ous 6 android in-app-purchase in-app-billing billingclient

我的一些用户告诉我,我的应用程序时不时会忘记购买的订阅。它会工作 3-4 天,然后就会忘记它们。这是一个非常重要的问题,因为用户可能怀疑存在欺诈行为。我正在使用计费库 4.0.0,并且我已经按照 Google 的指南实现了计费逻辑。

据我所知,当由于某种原因计费服务连接中断时,就会发生这种情况。(以Play商店正在更新为例)

我已设法通过以下方式复制此场景

- Disable internet connection
- Clearing Play Store app data
- Fresh launch of my app.
- Call billingClient.startConnection()
    onBillingSetupFinished called with responseCode BILLING_UNAVAILABLE
    user sees -> The app says "no subscription purchased"

- Enable internet connection
- re-initialize BillingClient.
    onBillingSetupFinished called with responseCode OK. billingClient.isReady() returns true. 
- Call billingClient.queryPurchasesAsync() and billingClient.querySkuDetailsAsync().
    onSkuDetailsResponse is called with the skuDetailsList filled with all the proper data. However:
    onQueryPurchasesResponse is called with empty purchase list -> Again user sees "no subscriptions purchased"
Run Code Online (Sandbox Code Playgroud)

重要如果此时我打开 Play 商店,它会显示已购买的订阅。但该应用程序仍然得到一个空的购买列表。

如果我继续打电话billingClient.startConnection()billingClient.queryPurchasesAsync()在大约 10 分钟后的某个时间,一次尝试将成功并返回一个非空的购买列表。

是否可以告诉 Play 商店刷新我的应用程序的订阅数据?如何才能优雅地处理这种情况?

Yur*_*nko 1

acknowledgePurchase每次购买都需要打电话。
请参阅官方文档文章了解更多详细信息。