简体   繁体   中英

Android in-app purchase - RESULT_ITEM_UNAVAILABLE

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!

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

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.

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).

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM