【问题标题】:How to hide the inactive products from in app billing?如何在应用计费中隐藏非活动产品?
【发布时间】:2013-08-11 22:12:21
【问题描述】:

我们有一个支持 In App Billing v3 的 Android 应用。在我们的测试中,其他一切都运行良好,但我们发现也可以通过查询库存来获得不活跃的产品。

这是我们在应用产品库存中查询 Google Play 的方式:

ArrayList<String> moreSkus = new ArrayList<String>();
moreSkus.add("gas");
moreSkus.add("premium");
mHelper.queryInventoryAsync(true, moreSkus, mGotInventoryListener);

...

IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, final Inventory inventory) {
        if(inventory.hasDetails("premium")) {
            System.out.println("Inactive product is also visible to app!");
        }
    }
};

这两个产品中,“premium”是不活跃的,但IabHelper.QueryInventoryFinishedListener中的打印语句仍然执行!

有没有办法只获得活跃的产品?

【问题讨论】:

  • 如果你知道溢价是不活跃的,你为什么要查询它?

标签: java android in-app-purchase google-play in-app-billing


【解决方案1】:

AFAIK,您可以从查询列表中删除 sku

//moreSkus.add("premium"); //don't query this item

这取决于你的代码,但有点道理,因为你不能用一个空的“moreSku”列表查询所有可用的产品,你必须选择你真正想要的;无论如何,这取决于您的代码。 希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多