I have a really strange problem with Google In-app billing API.
I want to get the details of my available subscriptions to show their localised price on the UI. I'm using the IabHelper to query the details of the SKUs I specify, but the result contains no products, but after I purchase the subscription it's working, even if I cancel the subscription then and reinstall the app.
Here is my code:
List<String> additionalSkus = new ArrayList<>();
for (Subscription subscription : subscriptions) {
additionalSkus.add(subscription.getSku());
}
iabHelper.queryInventoryAsync(true, additionalSkus, new IabHelper.QueryInventoryFinishedListener() {
@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv) {
if (iabHelper == null || result.isFailure()) {
Log.i("subs", result.getMessage());
}
for (Subscription subscription : subscriptions) {
SkuDetails skuDetails = inv.getSkuDetails(subscription.getSku());
if (skuDetails != null) {
subscription.setLocalizedPrice(skuDetails.getPrice());
Log.i("subs", subscription.getLocalizedPrice());
}
}
}
});
I have everything set up right about the In-app billing process. My products are active, I have a published beta APK, I can even get the details of my managed products, and purchase managed products and subscriptions, but this isn't working.