I have followed the steps for in app billing:
- Installed demo app
- Published an in-app product
- NOT published the app itself
Although I CAN buy the item, there is a curious warning “item not found” that I have to dismiss before I can go to the buy screen.
AND this log error:
E/Volley(1384): [157] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/details?doc=subs:com.testorooney.testo:sword_001
This is NOT a server side bug. The bug is in the onClick for the Purchase button in the Dungeons class of the sample application.
The supplied method has a bug in the if {} else if {} statement where it causes the mBillingService.requestPurchase to be called twice, when the selected item is not a subscription item (mManagedType != Managed.SUBSCRIPTION). So the same item will be requested twice, once with an item type of “inapp” (which is the valid request) and immediately after that with an item type of “subs” (which is incorrect and it shows “item not found”).
Here is the buggy code:
To fix this, add mManagedType == Managed.SUBSCRIPTION to the else if above.
Here is how the function should look: