2

I am personally finding the documentation with the Android Billing Library a bit scarce, I can't make too much sense this in-app billing.

I understand the method requestPurchase() and how to add items into the catalog. But which methods are used to find what items have been purchased and their state etc?

Does anyone have any sample code that shows the basics of purchasing/ returning purchased items etc?

Jonno
  • 1,542
  • 3
  • 22
  • 39
  • Isn't this just another way of phrasing your [other](http://stackoverflow.com/q/9199831/1101070) question? You should know that this sort of thing is frowned upon on Stack Overflow :) – Marvin Pinto Feb 08 '12 at 21:31
  • 1
    It isn't no. It's a genuine question as I'm currently stuck looking through the library as to which methods to call – Jonno Feb 08 '12 at 21:38
  • Did you happen to read the answer I posted? That library has a big disclaimer mentioning that it's **not to be used in production code**. Just an FYI. As I also pointed out in that answer, start [here](http://developer.android.com/guide/market/billing/index.html) and go through the examples. That's the _correct_ way of going about it. – Marvin Pinto Feb 08 '12 at 21:41
  • 1
    It was published over a year ago, and also states it is a good starting point. I have completed the example and have it working, and intended on using the library to simplify a mountain of code. – Jonno Feb 08 '12 at 21:45

2 Answers2

5

The "method" used to find what items have been purchased is a request Bundle defined as "GET_PURCHASE_INFORMATION".

In Google's market_billing sample, it is performed via GetPurchaseInformation.run() in the service module.

This tutorial video can be very helpful in understanding not only security considerations involved but also the actual protocol as there is a downloadable PDF on the right pane, which includes a colorful diagram that may be clearer than the sequence diagram in the Dev Guide.

Hope this helps.

Bill The Ape
  • 3,261
  • 25
  • 44
1

I am personally finding the documentation with the Android Billing Library a bit scarce, I can't make too much sense this in-app billing.

Before using the library, I strongly recommend that you read Google's In-app Billing API Guide. The library assumes that you're familiar with the concepts outlined there.

Does anyone have any sample code that shows the basics of purchasing/ returning purchased items etc?

The library comes with sample code: Dungeons Redux. As the name indicates, it is based on Google's Dungeons sample code and provides similar functionality.

But which methods are used to find what items have been purchased and their state etc?

Check out BillingController, which should have adequate Javadoc coverage.

hpique
  • 119,096
  • 131
  • 338
  • 476