Ald*_*hew 12 android play-billing-library
在尝试将 Google 结算集成从版本 4 迁移到版本 5 时,我在调用 queryProductDetailsAsync 时收到错误“客户端不支持 ProductDetails”。
List<QueryProductDetailsParams.Product> productList = List.of(QueryProductDetailsParams.Product.newBuilder()
.setProductId("ppgapp1")
.setProductType(BillingClient.ProductType.SUBS)
.build());
Run Code Online (Sandbox Code Playgroud)
QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
.setProductList(productList)
.build();
billingClient.queryProductDetailsAsync(params, listener);
Run Code Online (Sandbox Code Playgroud)
迁移时是否需要在控制台上进行任何更改?
提交到 Google 结算集成的封闭或内部测试轨道需要多长时间才能完成审核?
当我的模拟器 PlayStore 应用程序版本太旧时,我遇到同样的问题(在我的情况下是23.0.21...)
将 PlayStore应用程序更新到新版本将解决问题(30.9.0...)
如果你想引导用户更新PlayStore应用程序,你可以这样做
billingClient.queryProductDetailsAsync(productParams) { billingResult, productDetails ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED) {
Log.e("TAG", "Feature not supported ")
runOnUiThread {
Toast.makeText(this@MainActivity, "Please update PlayStore app", Toast.LENGTH_LONG).show()
// or AlertDialog or any error message
}
return@queryProductDetailsAsync
}
...
}
Run Code Online (Sandbox Code Playgroud)
我也遇到过同样的问题。我找不到任何有关问题发生原因的信息。检查是否支持ProductDetail功能后即可使用。
BillingResult billingResult = billingClient.isFeatureSupported( BillingClient.FeatureType.PRODUCT_DETAILS );
if ( billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK ) {
// use billingClient.queryProductDetailsAsync()
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6808 次 |
| 最近记录: |