I have implemented in app products in my app. I can make successful purchase and everything works fine. But in one device, purchase doesn't work although when I try to make a purchase again, I get the response "Product already owned" which shows that the purchase is fine. But queryPurchase() returns an empty purchase list.
I've only one email on that device.
public void queryPurchase() {
Runnable queryPurchaseRequest = getQueryPurchaseRequest();
executeRequest(queryPurchaseRequest);
}
private Runnable getQueryPurchaseRequest() {
return new Runnable() {
@Override
public void run() {
Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(BillingClient.SkuType.INAPP);
if(purchasesResult.getResponseCode() == BillingResponseCode.OK) {
ArrayList<Purchase> purchaseList = new ArrayList<>();
purchaseList.addAll(purchasesResult.getPurchasesList());
if(isSubscriptionSupported()) {
Purchase.PurchasesResult subscriptionResult
= mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (subscriptionResult.getResponseCode() == BillingResponseCode.OK) {
purchaseList.addAll(subscriptionResult.getPurchasesList());
} else {
Log.e(TAG, "Got an error response trying to query subscription purchases");
}
}
onQueryPurchasesFinished(purchaseList);
} else {
Utilities.setPurchaseLog("onBilling manager on query purchase request: result unknown
");
}
}
};
}
Note: Billing result, subscription response code everything seems successful. And everything is working perfectly on other devices.
Have anyone any solution? Thanks for your help!
question from:
https://stackoverflow.com/questions/65848755/android-querypurchase-returns-an-empty-list-but-i-purchased-an-in-app-produc 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…