尝试查询应用内结算产品但没有运气,当您处于草稿模式时,是否可以对应用内结算产品进行查询?

时间:2015-07-15 14:27:49

标签: android in-app-billing

据我所知,截至2015年5月,Google改变了他们在草稿模式下处理您应用的方式 -

  

在少数情况下,您可以使用未发布的应用测试Google Play功能。例如,您可以使用静态响应,始终返回特定结果的特殊保留产品ID来测试未发布应用的应用内结算支持(例如"已购买"或"已退款&# 34。)

我的问题是你可以在草稿模式下的产品上使用IabHelper.queryInventoryAsync()。我知道要购买你必须使用保留的产品ID,但查询呢?这个问题源于这样一个事实:当我从我的监听器中获取清单时,我将返回null。

        final String SKU_VERBAL_HINT = "verbal_00.thisthat";
            // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);

    // enable debug logging (for a production application, you should set this to false).
    mHelper.enableDebugLogging(true);

    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d("Issue", "Problem setting up In-app Billing: " + result);
            }else{
                //List<String> additionalSkuList = new ArrayList<String>();
                //additionalSkuList.add(SKU_VERBAL_HINT);
                String[] moreSkus = {SKU_VERBAL_HINT};
                mHelper.queryInventoryAsync(true, Arrays.asList(moreSkus),
                        mQueryFinishedListener);
                Log.d("Issue", "No Problem setting up in-app billing " + result);
            }
        }
    });

            mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
        public void onQueryInventoryFinished(IabResult result, Inventory inventory)
        {
            if (result.isFailure()) {
                // handle error
                return;
            }

         **-------->FAILS HERE, null inventory**  String verbalPrice =
                    inventory.getSkuDetails(SKU_VERBAL_HINT).getPrice();
            String verbal2 = verbalPrice;
            // update the UI
        }
    };

1 个答案:

答案 0 :(得分:0)

看看这个答案。草稿应用程序不受支持。

  

不再支持BlockquoteDraft应用程序   以前,您可以发布&#34;草案&#34;用于测试的应用版本。不再支持此功能。相反,您可以通过两种方式测试预发布应用在Google Play商店中的运作方式:

您可以将应用发布到Alpha或Beta分发渠道。这使得应用程序可以在Google Play商店中使用,但仅适用于您在白名单&#34;上放置的测试人员。 在少数情况下,您可以使用未发布的应用测试Google Play功能。例如,您可以使用静态响应,始终返回特定结果的特殊保留产品ID来测试未发布应用的应用内结算支持(例如&#34;已购买&#34;或&#34;已退款&# 34。)

  

块引用

https://stackoverflow.com/a/24866513/2192015

从这听起来好像应用程序必须发布到alpha或beta频道才能进行测试。 http://developer.android.com/google/play/billing/billing_testing.html#draft_apps