14
votes

I'm trying to integrate Android Market in-app purchases into my app, but unfortunately coming across an annoying error every time I try to purchase a test product.

I've taken the sample application (Dungeons) and added it to my app. I've updated the Public Key and also updated the list of products to the following:

/** An array of product list entries for the products that can be purchased. */
private static final CatalogEntry[] CATALOG = new CatalogEntry[] {
    new CatalogEntry("lemonstorm.huru.full", "Full v", Managed.MANAGED),
    new CatalogEntry("android.test.purchased", "purchased",Managed.UNMANAGED),
    new CatalogEntry("android.test.canceled", "cancelled",Managed.UNMANAGED),
    new CatalogEntry("android.test.refunded", "Refunded",Managed.UNMANAGED),
    new CatalogEntry("android.test.item_unavailable", "unavailable",Managed.UNMANAGED)
};

I've exported the application using Eclipse, and installed it on my phone and also uploaded it to the Android Market website. Also on the Android Market website I've added lemonstorm.huru.full as an in-app purchase and published it.

I've also added my googlemail account as a testing account (that is the one I'm signed into on my phone).

When I run the application on my phone I get a RESULT_ITEM_UNAVAILABLE message whenever I try to buy lemonstorm.huru.full, but if I try for example, android.test.purchased, it works absolutely fine.

The documentation for RESULT_ITEM_UNAVAILABLE states the following:

Indicates that Android Market cannot find the requested item in the application's product list. This can happen if the product ID is misspelled in your REQUEST_PURCHASE request or if an item is unpublished in the application's product list.

The product ID is definetely the same, it's definetely published and the request must be going through ok as it's the sample application and it worked for android.test.purchased

Any thoughts would be appreciated!

6
I have the same problem, but I did found someone else having a problem with a googlemail account. Not sure if that would help you. Link: osdir.com/ml/Android-Developers/2011-03/msg05455.htmlbeetstra
I tried adding both [email protected] and [email protected] to the testing list, didn't seem to do anything though!RichW
read the FAQ... This works only with a gmail.com account. Its a known bug.. They are trying to fix it... Only the testing Part... Actual implementation does work in all mail providers.Anoop Chandrika HarisudhanNair
Which FAQ is this you're looking at? If you put that as an answer i'll accept it. Thanks!RichW
Have added your "items for sale" in the market account.? Under the app each in-app item needs to added. Do take a look at this... developer.android.com/guide/market/billing/billing_admin.htmlAnoop Chandrika HarisudhanNair

6 Answers

8
votes

I had this same problem. After I published the application, the products were found. Looks like a bug in Google's test accounts(?)

6
votes

I've had the same issue. I was playing with Dungeons sample and missed that sword_001 and potion_001 products must be "Published". The problem for me was that they where just saved and remained "Unpublished".

To solve it I've just edited products and pressed Publish button for both. Now I can buy both from the sample app.

3
votes

I got BillingClient.BillingResponse#ITEM_UNAVAILABLE response and this message from Play Billing Library:

ProxyBillingActivity: Got purchases updated result with resultCode 0 and billing's responseCode: 4

It turns out, I forgot to visit the opt-in link for testing (I only added the tester to list of alpha testers and to the list of users with license testing access).

1
votes

As far as I know:

  1. Does the version code the same with unpublished draft application in your application publish site?
  2. Did you Touch Factory data reset to test account?
  3. Did you set managed product of your lemonstorm.huru.full in publish site?
1
votes

Here is a great rundown for how to test in-app billing, it includes a chart for what you can expect to see from the market app in situations where an app is published vs. non published and using a user that is a test user, developer, or other:

http://developer.android.com/guide/market/billing/billing_testing.html

1
votes

Also, remember to sign the app when you export it.