安卓应用内购买v3,谷歌商店对话框未显示。

4

我目前正在将IAB v2迁移到v3。

在v2中,如果您拥有要购买的特定物品,Google Play对话框会以红色文本颜色显示“您已经拥有此物品”。在v3中,我可以得到错误响应5(物品已经拥有),但是Google Play对话框永远不会出现在屏幕上。

我正在使用最新的示例代码IabHelper,如果响应不为0,则似乎没有启动意图。

        logDebug("Constructing buy intent for " + sku + ", item type: " + itemType);
        Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData);
        int response = getResponseCodeFromBundle(buyIntentBundle);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logError("Unable to buy item, Error response: " + getResponseDesc(response));
            flagEndAsync();
            result = new IabResult(response, "Unable to buy item");
            if (listener != null)
                listener.onIabPurchaseFinished(result, null);
            return;
        }

        PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
        logDebug("Launching buy intent for " + sku + ". Request code: " + requestCode);
        mRequestCode = requestCode;
        mPurchaseListener = listener;
        mPurchasingItemType = itemType;
        act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));

是否可以像v2那样操作?还是我需要在我的应用程序中创建一条带有“已拥有”提示的对话框?

1个回答

0
有没有可能表现跟v2一样?或者我应该在我的应用程序中创建一个对话框,显示“已拥有”?
是的,这个问题已经报告了,更新的IAB v3存储库 在此处可用。您提到的崩溃已使用此仓库进行修复。
注意:
正如Bruno Oliveira所述。

1
我已经按照你的建议将最新代码放入我的应用程序中。崩溃不会发生,但是谷歌Play商店对话框没有显示出来。如果我已经拥有该项目,Play商店将不会启动吗? - user2223820

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接