When you deactivate an in-app product on Play Console, it can take some time for the changes to propagate across all Google servers. It is possible that the product details are still cached on your device or the Google servers that your app is communicating with.
To ensure that your app does not display inactive products, you can use the SkuDetailsResponseListener interface of the BillingClient object to receive the product details response. In the response, you can check the SkuDetails object's isRewarded and isSubscription fields to determine if the product is active or not.
For example, you can modify your BillingClient.queryProductDetails callback method as follows:
List<String> skuList = new ArrayList<>();
skuList.add("your_product_id");
billingClient.querySkuDetailsAsync(
SkuDetailsParams.newBuilder()
.setSkusList(skuList)
.setType(BillingClient.SkuType.INAPP)
.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> skuDetailsList) {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
for (SkuDetails skuDetails : skuDetailsList) {
if (!skuDetails.isRewarded() && !skuDetails.isSubscription()) {
// This product is inactive, do not display it to the user
continue;
}
// Process the active product
}
}
}
});
This code snippet checks if the retrieved SkuDetails object is a subscription or a rewarded product, and if it is not, it is skipped and not displayed to the user.
By implementing this check, your app should not display inactive products even if they are still cached on your device or the Google servers.