在应用程序内结算V3无法查询没有网络连接或飞机/飞行模式项目 [英] In-app billing v3 unable to query items without network connection or in airplane/flight mode

查看:292
本文介绍了在应用程序内结算V3无法查询没有网络连接或飞机/飞行模式项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在与我的项目修改它去通过v3的示例文件工作正常。但是我的朋友刚刚通过打开无线网络连接关闭,开启飞行模式测试code。这似乎导致不能够查询应用程序内库存

Going through the v3 example file in modifying it with my project works fine. However my friend just tested the code by turning wi-fi off and turning on airplane mode. This seems to result in not being able to query the in-app inventory.

// Listener that's called when we finish querying the items and subscriptions we own
private final IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    @Override
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

        if (result.isFailure()) {
            // STOPS here and doesn't continue on with no network connection
            return;
        }

        ......
    }
};

我认为,一个成功的初始购买的是当地在它的缓存,这样,它确实V3店并不总是必须有一个网络连接,检查后。有没有其他人遇到了这个问题?我希望我失去了一些东西完全明显,或者如果这是怎么它应该工作。

I thought that after a initial successful purchase that v3 stores that locally in it's cache so that it didn't always have to have a network connection to check. Has anyone else ran into this issue? I hope I'm missing something completely obvious or if this is how it's supposed to work.

推荐答案

我想我可能已经找到了答案。在下面的V3的TrivialDriveExample我打电话了mHelper.startSetup(该queryInventoryAsync功能)功能,就像这样:

I think I may have found the answer. In following v3's TrivialDriveExample I was calling the queryInventoryAsync function in the mHelper.startSetup() function like so:

Log.d(TAG, "Setup successful. Querying inventory.");
mHelper.queryInventoryAsync(mGotInventoryListener);

相反,现在我过我的单品,我想查询一个字符串数组列表:

Instead now I'm passing a String array list of my SKUs that I want to query for:

List<String> skulist = new ArrayList<String>();
skulist.add("my_sku_name1");
skulist.add("my_sku_name2");
mHelper.queryInventoryAsync(true, skulist, mGotInventoryListener);

我然后打开飞行模式测试,我可以查询我的购物精品!

I then tested by turning on flight mode and I was able to query my purchases fine!

这篇关于在应用程序内结算V3无法查询没有网络连接或飞机/飞行模式项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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