相关疑难解决方法(0)

应用内结算测试:android.test.purchased已经拥有

我目前正在为未来的应用程序测试In-App Billing,并且在我第一次成功"购买"测试项目"android.test.purchased"后,我现在每次尝试再次购买时都会收到响应代码7,这意味着我已经拥有了这个项目.

12-15 23:02:14.149:E/IabHelper(19829):应用内结算错误:无法购买商品,错误回复:7:商品已经拥有

根据我的理解,这次购买应该永远是可能的,对吧?那么开发人员可以测试他/她的应用程序?

如果没有,我如何"重置"其状态为不拥有?我正在使用Google In-App Billing Sample中的util包.

android in-app-billing

110
推荐指数
9
解决办法
6万
查看次数

inventory.getPurchase()总是返回null,尽管已经购买了

我正在使用in-ap购买样本.我的应用程序有2个按钮,第一个按钮默认禁用,点击第二个按钮将购买并启用第一个按钮.购买按钮工作正确,但购买后,我检查库存但它总是返回null,这意味着我还没有购买.

这是源代码:

建立:

@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 = "key";
    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");
            }
            // Query to detect user was buy this item or not
            mHelper.queryInventoryAsync(mReceivedInventoryListener);
        }
    });

    buyButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View …
Run Code Online (Sandbox Code Playgroud)

android in-app-purchase in-app-billing android-billing

6
推荐指数
1
解决办法
6445
查看次数