मैं इनप्बिलिंग का डेमो बनाने की कोशिश कर रहा हूं। इस अध्ययन के लिए मैंने इस tutorial का पालन किया।InappBilling त्रुटि- प्रमाणीकरण आवश्यक है। आपको अपने Google खाते में साइन इन करने की आवश्यकता है
Lemme चरणों मैं इस कार्य को
करने के लिए पीछा किया बताओ मैं नीचे उल्लेख कोड
package com.ohn.inappbilling; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.View; import android.widget.Button; import com.hello.inappbilling.util.IabHelper; import com.hello.inappbilling.util.IabResult; import com.hello.inappbilling.util.Inventory; import com.hello.inappbilling.util.Purchase; import com.ohn.inappbilling.R; public class MainActivity extends ActionBarActivity { private static final String TAG = "com.hello.inappbilling"; static final String ITEM_SKU = "com.buttonclick"; IabHelper mHelper; private Button clickButton; private Button buyButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buyButton = (Button) findViewById(R.id.buyButton); clickButton = (Button) findViewById(R.id.clickButton); clickButton.setEnabled(false); String base64EncodedPublicKey = "******"; mHelper = new IabHelper(this, base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d(TAG, "In-app Billing setup failed: " + result); } else { Log.d(TAG, "In-app Billing is set up OK"); } } }); //throw new RuntimeException(); } public void buttonClicked(View view) { clickButton.setEnabled(false); buyButton.setEnabled(true); } public void buyClick(View view) { mHelper.launchPurchaseFlow(this, ITEM_SKU, 10001, mPurchaseFinishedListener, "mypurchasetoken"); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (!mHelper.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } } IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() { public void onIabPurchaseFinished(IabResult result, Purchase purchase) { if (result.isFailure()) { // Handle error return; } else if (purchase.getSku().equals(ITEM_SKU)) { consumeItem(); buyButton.setEnabled(false); } } }; public void consumeItem() { mHelper.queryInventoryAsync(mReceivedInventoryListener); } IabHelper.QueryInventoryFinishedListener mReceivedInventoryListener = new IabHelper.QueryInventoryFinishedListener() { public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (result.isFailure()) { // Handle failure } else { mHelper.consumeAsync(inventory.getPurchase(ITEM_SKU), mConsumeFinishedListener); } } }; IabHelper.OnConsumeFinishedListener mConsumeFinishedListener = new IabHelper.OnConsumeFinishedListener() { public void onConsumeFinished(Purchase purchase, IabResult result) { if (result.isSuccess()) { clickButton.setEnabled(true); } else { // handle error } } }; @Override public void onDestroy() { super.onDestroy(); if (mHelper != null) mHelper.dispose(); mHelper = null; } }
मैं फ़ाइल-निर्यात-AndroidProject का उपयोग कर apk बनाया का इस्तेमाल किया और इस अपलोड की गई alphatesting।
मैंने में उपयोगकर्ताओं (Google समूह) को अल्फा परीक्षण में में प्रबंधित करें।
मैं ऐप्स के तहत उत्पाद में उत्पाद जोड़ा गया है और इसे करने के लिए com.buttonclick
आईडी देना जीमेल परीक्षण पहुँच मैं जोड़ा जीमेल आईडी यहां भी है के साथ खातों में सेटिंग्स में। आईडी में से कोई भी डेवलपर आईडी नहीं है।
क्या कोई इस समस्या के लिए समाधान बता सकता है। मैंने StackoverFlow
पर उपलब्ध सभी समाधानों का प्रयास किया है।
पता नहीं है कि यह संबंधित है, लेकिन मैंने कभी भी टेस्टर के रूप में मुख्य/पहले खाता सेट के बिना आईएबी का परीक्षण नहीं किया है, मुझे डिवाइस को रीसेट करना था और परीक्षक खाते को डिवाइस के मुख्य खाते के रूप में सेट करना था। – Hacketo
का मतलब है कि आप कहना चाहते हैं, मैं फोन से सभी खातों को हटा देता हूं, फिर परीक्षण के लिए एक खाता जोड़ता हूं, है ना? –