问题
I am getting a weird issue from the in-app purchase IInAppBillingService version 3
since 1 week ago.
Below are the steps what I had followed:
Note: I followed these steps because few of my users got same network issue but purchase has been completed. But app still showing Buy button for that product. So to replicate the issue I had to follow these steps.
- Installed the debuggable signed APK over the play store version.
- Clicked on item to buy
- Opened the play store popup with Buy button. Clicked on
Buy
in the purchased popup - I lost the network while purchasing a product. Got a popup with
No Internet Connection
- Clicked on
ok
in theNo Internet Connection
popup. Return to my application. - Again clicked on item to buy.
- Now got the
Error --> You already owned this item
But the problem is, I didn't get any purchase result in the app mPurchaseFinishedListener callback
. I got Null. Even I got the email from the google and I checked that whether it is purchased or not in the Google Play store --> Menu --> Account --> Order History
My product is Managed Product
but user can purchased it multiple times. So for that, whenever opening the product or after finishing the purchase consuming the desired purchase based on the skuId if it is purchased.
if (purchase != null && purchase.getItemType().equalsIgnoreCase("inapp"))
{
mHelper.consumeAsync(purchase, mConsumeFinishedListener);
}
Now I am not able consume the product or even not able to purchase. Why is it so that play store completed the purchase but it didn't return the purchase details to callback?
As far as I know if an item already purchased for that SKUID it should return the purchase details. But in my case it is not returning the purchase details.
Can any one help me to resolve this issue?
回答1:
Do you get an error code of 2 in the response?
It looks like an issue of Google Play services and the Google Play client app getting out of sync because of no network. When the network is available and the sync happens (in a few hours time), you'll be able to buy the product again.
来源:https://stackoverflow.com/questions/44548649/android-in-app-purchase-while-purchasing-got-network-failed-popup-but-purchase