为了解决这个问题,可以尝试使用SkuDetailsParams参数来获取SKU的详细信息。以下是一个示例代码,展示如何使用SkuDetailsParams从Google Play Console获取SKU详细信息。
// Create a SkuDetailParams object with your SKU IDs
List skuList = new ArrayList<>();
skuList.add("your_sku_id_1");
skuList.add("your_sku_id_2");
SkuDetailsParams.Builder paramsBuilder = SkuDetailsParams.newBuilder();
paramsBuilder.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
SkuDetailsParams params = paramsBuilder.build();
// Call querySkuDetailsAsync() method with params object to retrieve details
billingClient.querySkuDetailsAsync(params, new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult, List skuDetailsList) {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (SkuDetails skuDetails : skuDetailsList) {
// Get SKU details
String sku = skuDetails.getSku();
//... Do something with the SKU details
}
}
}
});
通过这种方式,我们可以获取到SKU的详细信息并进行相关处理。