我目前正在将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那样操作?还是我需要在我的应用程序中创建一条带有“已拥有”提示的对话框?