I have an app which has in-app purchases using Google's In-App Billing API. This generally works well, even with internet connection being lost after the purchase has been made, which makes the product show up as an un-consumed purchase. However in some edge case involving turning wifi on & off a few times during the purchase, it sometimes happens that the purchase is processed (i.e. money has been paid), but not yet consumed in the app.
When using the getPurchases() method, this product is not returned as an un-consumed purchase, even though the documentation says it should be. When trying to purchase this product again, however, the API does return the code BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED
.
So this product is marked as un-consumed.
Interestingly, after I run the command adb shell pm clear com.android.vending
in my terminal, this product does show up in the list returned from getPurchases()
.
What is happening here that the product only shows up as an un-consumed product after running the terminal command? How can I get this product to show up as it should in the getPurchases call?
(If this issue cannot be fixed, perhaps I might, upon loading the view where purchases can be made, "simulate" the buying process for each item, check whether it returns the BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED
code, grant the user the purchase for each item that does and resolve this purchase programmatically. This seems way exaggerated though.)