I think I have things setup correctly, but I keep getting
REQUEST_ITEM_UNAVAILABLE.

DDMS reports the following
06-18 21:09:27.714: DEBUG/iDHaysbert(5449): ItemName : Hello(a)
SettingRingToneUri :
android.resource://com.haysbertv2/raw/hello3timescomeonpickupthephone2.mp3
PurchaseUri : hello3timescomeonpickupthephone2
06-18 21:09:27.714: DEBUG/iDHaysbert(5449): Sending Request id
hello3timescomeonpickupthephone2
06-18 21:09:27.722: DEBUG/iDHaysbert(5449): RequestPurchase
06-18 21:09:27.730: DEBUG/iDHaysbert(5449): request id: 7697028544955964412
06-18 21:09:30.323: INFO/iDHaysbert(5449): handleCommand() action:
com.android.vending.billing.RESPONSE_CODE
06-18 21:09:30.323: DEBUG/iDHaysbert(5449): Check response code
RequestPurchase: RESULT_ITEM_UNAVAILABLE
06-18 21:09:30.323: DEBUG/iDHaysbert(5449): product id :
hello3timescomeonpickupthephone2: RESULT_ITEM_UNAVAILABLE
06-18 21:09:30.323: INFO/iDHaysbert(5449): purchase failed
06-18 21:09:30.339: DEBUG/iDHaysbert(5449):
hello3timescomeonpickupthephone2: request purchase returned
RESULT_ITEM_UNAVAILABLE
I have 2 email accounts (gmail). Account A is my primary account on my
device and my test account on my market account. Account B is owner
account on market.
I have a in app product "hello3timescomeonpickupthephone2" with product id.
All checkout file is under com.mcondev.test package and not
"com.example. (from the sample).
Changed the package of some Consts variables
// Intent actions that we send from the BillingReceiver to the
    // BillingService.  Defined by this application.
    public static final String ACTION_CONFIRM_NOTIFICATION =
        "com.mcondev.test.CONFIRM_NOTIFICATION";
    public static final String ACTION_GET_PURCHASE_INFORMATION =
        "com.mcondev.test.GET_PURCHASE_INFORMATION";
    public static final String ACTION_RESTORE_TRANSACTIONS =
        "com.mcondev.test.RESTORE_TRANSACTIONS";
Android Manifest has
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required permission to use in-app billing. -->
<uses-permission android:name="com.android.vending.BILLING" />
<service android:name="com.mcondev.test.BillingService" />
<receiver android:name="com.mcondev.test.BillingReceiver">
<intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>
</receiver>

AIDL
package com.android.vending.billing;
import android.os.Bundle;
interface IMarketBillingService {
    /** Given the arguments in bundle form, returns a bundle for results. */
    Bundle sendBillingRequest(in Bundle bundle);
}

Const.java changes
    public static final String MARKET_BILLING_SERVICE_ACTION =
        "com.android.vending.billing.MarketBillingService.BIND";
    public static final String ACTION_CONFIRM_NOTIFICATION =
        "com.mcondev.test.CONFIRM_NOTIFICATION";
    public static final String ACTION_GET_PURCHASE_INFORMATION =
        "com.mcondev.test.GET_PURCHASE_INFORMATION";
    public static final String ACTION_RESTORE_TRANSACTIONS =
        "com.mcondev.test.RESTORE_TRANSACTIONS";

Refactored and merged Dungeons to CheckoutPurchaseObserver. Removed
CATALOG code. Here are pieces of code.
public CheckoutPurchaseObserver(Activity newActivity, Handler newHandler) {
                super(newActivity, newHandler);
                context = newActivity.getApplicationContext() ;
                mHandler = newHandler ;
                
                mPurchaseDatabase = new PurchaseDatabase(context);
                mBillingService = new BillingService();
                mBillingService.setContext(context);

                // Check if billing is supported.
                ResponseHandler.register(this);
                if (!mBillingService.checkBillingSupported()) {
                        showDialog(DIALOG_CANNOT_CONNECT_ID);
                }
                
        }
       public void sendCheckoutRequest(String itemId, String quantity) {
                if (Consts.DEBUG)
                        Log.d(TAG, "Sending Request id "+itemId) ;
                if (!mBillingService.requestPurchase(itemId, quantity)) {
                        showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
                }
        }
..... all checkoutpurchaseobserver code ....
}

Is there anything wrong with this refactor ?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to