user1292458
user1292458

Reputation:

my android in-app purchase not working with error product could not be purchased

i am developing android in-app application with static In-app Product ID: android. test. purchased that is working good and i also get Toast message: Thank you.You item will be appear shortly. but in actual Product ID:com.android.example not working properly.and i don't know toast message class now i am what to do.

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

    mainview=(ImageView)findViewById(R.id.comcontractsol);

    mBillingObserver = new AbstractBillingObserver(this) {

        @Override
        public void onBillingChecked(boolean supported) 
        {
            Dungeon.this.onBillingChecked(supported);
        }

        @Override
        public void onPurchaseStateChanged(String itemId, PurchaseState state) 
        {

            if(itemId.equals("android.test.purchased"))
            {       
                mainview.setBackgroundResource(R.drawable.unlock);
                Dungeon.this.onPurchaseStateChanged(itemId, state);
                startActivity(new Intent(getApplicationContext(), secondActivity.class));
            }
        }
        @Override
        public void onRequestPurchaseResponse(String itemId, ResponseCode response) 
        {
            Dungeon.this.onRequestPurchaseResponse(itemId, response);
        }
    }

Upvotes: 1

Views: 1086

Answers (2)

user1598050
user1598050

Reputation:

you should care about your product_id and item_id. if product_id cant match then error will be accure.

1.Create .apk file and upload it in android market but do not publish it only publish your product id.

2.now change your static id with real id and run it.

Upvotes: 1

Androider
Androider

Reputation: 2804

If you want "com.android.example" as product id then you have to follow these steps:

  1. Create .apk file and upload it in android market but do not publish it.

  2. Find In-App purchase(items) link and create a product and publish it. The product name must be same as "com.android.example". So I suggest you to use a meaningful product Id.

See this similar question

In order to test your application, you have to create test account see this link

Upvotes: 0

Related Questions