9

I am trying to implement in-app. In android, in-app is working perfectly.But, when I remove the app from device and reinstall it, then after if I try to purchase, it displays this message (product is Managed and in-app API Version 2)

enter image description here

and in log, I have an error RESULT_DEVELOPER_ERROR , then I googled and I found the Version 3 has more number of response codes like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED

So if product is already purchased, the response must be like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED and this is not possible in Version 2.

Then what should I do ? Do I need to implement Version 3 ?

Youddh
  • 1,511
  • 4
  • 34
  • 51

3 Answers3

11

if you want force to buy product by every time then product should be Unmanaged.

Products can be of 3 types

1) Managed

2) Unmanaged

3) Subcription

Managed means google it self keep record. so by using same email id user not have to paid its charge e.g. remove ads

Unmanaged means user have to buy every time and will be a charged. e.g. Pocker chips

This 2 example i have read on developer site..

and refer http://developer.android.com/google/play/billing/billing_admin.html

Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
  • Thank you for your comment. I do not want to force to buy the product every time. I just want to receive something like "already purchased" notification instead of "RESULT_DEVELOPER_ERROR" when user tries to buy product that he owns already. – Nick Jan 18 '13 at 11:34
4

Have you looked into RESTORE_TRANSACTIONS?

I had pretty much the same problem you describe above. My code is, for the most part, taken from the Market Billing Sample Application.

I added a RESTORE button to my purchase activity which calls the BillingService.restoreTransactions routine.

If you search for RESTORE_TRANSACTIONS within this page: https://developer.android.com/google/play/billing/v2/api.html, you'll find that calling that routine re-triggers the PURCHASE_STATE_CHANGED broadcast.

Which, in my code, triggered the onPurchaseStateChange routine and it worked the same way it would on the initial purchase with the PurchaseState was set to PURCHASED.

jawsware
  • 924
  • 6
  • 13
3

I ended up with calling BillingService.restoreTransactions() after catching RESULT_DEVELOPER_ERROR. Looks odd, but works fine.

Nick
  • 3,205
  • 9
  • 57
  • 108
  • It is better to do the restoration before you try to make a purchase. You can have a "Restore purchased items" button. – Ray Jan 18 '13 at 19:45
  • I have a "Restore" button, but I cannot force user to press it instead of the "Buy" button :) – Nick Jan 19 '13 at 16:16