刷新库存时出错.应用内结算 [英] Error refreshing inventory. In-app Billing

查看:142
本文介绍了刷新库存时出错.应用内结算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置和测试应用内结算.我设法购买了android.test.purchased,它做了应该做的事情.但是现在我需要使用它来继续测试.问题是我无法到达库存.

I am setting up and testing in-app billing. I managed to purchase the android.test.purchased, and it did what it should. But now I need to consume it to continue my testing. The problem is that I can't reach the inventory.

当调用此方法时,我得到结果.调用了isFaliure()却无法获得库存.

When this is called I get the result.isFaliure() is called and I can't get the inventory.

IabHelper.QueryInventoryFinishedListener _gotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {

        @Override
        public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

            if (_iabHelper == null) return;

            if (result.isFailure()) {
                Log.d(TAG, "Failed to query inventory: " + result);
                return;
            }

            Log.d(TAG, "Query inventory was successful.");

            Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
            _isPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
            Log.d(TAG, "User is " + (_isPremium ? "PREMIUM" : "NOT PREMIUM"));

            update();
        }
    };

它记录错误消息

无法查询库存:IabResult:刷新库存时出错 (查询拥有的项目). (响应:-1003:购买签名 验证失败)

Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)

android.test.purchased仍然是拥有的-它不会让我再次购买.我的手机具有网络连接,不是那样.

The android.test.purchased is still owned - it won't let me buy it again. My phone has network connection so it's not that.

我还没有将签名的APK上传到Google Play,即使我使用Google的静态ID进行测试,这也有关系吗?

推荐答案

解决了... 静态购买ID似乎有问题. 这是我在 THIS 线程中找到的解决方法:

Solved it... It seems there are problems with the static purchase ID's. Here's a sollution I found in THIS thread:

If you have used the android.test.purchased then one way to get rid of the error is to do the following:-

 1. Edit Security.java and change the "return false" line in the
    verifyPurchase to "return true" - this is temporary, we'll be
    putting it back in a minute.
 2. In your QueryInventoryFinishedListener, after the "if
    (result.isFailure()) {...}" lines add the following to consume and
    get rid of your never ending android.test.purchased item:-

    if (inventory.hasPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD)) {
    mHelper.consumeAsync(inventory.getPurchase(SKU_ANDROID_TEST_PURCHASE_GOOD),null);
    }
 3. Run your app so the consunmeAsync happens, this gets rid of the
    "android.test.purchased" item on the server.
 4. Remove the consumeAsync code (or comment it out). Back in the
    Security.java, change the "return true" back to "return false".

这篇关于刷新库存时出错.应用内结算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆