gpt4 book ai didi

java - 在android studio的应用程序计费中总是返回 'BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED'

转载 作者:行者123 更新时间:2023-12-02 11:08:50 24 4
gpt4 key购买 nike

我正在尝试在我的应用程序中管理应用程序内结算,我曾经成功并获得应用程序内测试人员付款窗口,但过了一段时间,我总是从购买中获得这种类型的结果代码,即:

BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED 7 - 由于商品已被拥有而无法购买

有什么办法可以防止这种情况发生吗?

最佳答案

Purchase purchasePremium = null;
// The helper object
IabHelper mHelper;

@Override
protected void onCreate(Bundle savedInstanceState) {
{
// Create the helper, passing it our context and the public key to verify signatures with
Log.d(TAG, "Creating IAB helper.");
mHelper = new IabHelper(this, base64EncodedPublicKey);
}

public void onConsumePremiumButtonClicked(View arg0) {
if(purchasePremium != null)
{
Log.d(TAG, "We have Premium. Consuming it.");
try {
mHelper.consumeAsync(purchasePremium, mConsumeFinishedListener);
} catch (IabHelper.IabAsyncInProgressException e) {
complain("Error consuming Premium. Another async operation in progress.");
writeToLogFile("\nError consuming Premium. Another async operation in progress.");
}
}
else
{
alert("Please Subscribe the Product before Consuming it.",TAG,ActivityPurchaseManagedProduct.this);
}
}


// Called when consumption is complete
IabHelper.OnConsumeFinishedListener mConsumeFinishedListener = new IabHelper.OnConsumeFinishedListener() {
public void onConsumeFinished(Purchase purchase, IabResult result) {
Log.d(TAG, "Consumption finished. Purchase: " + purchase + ", result: " + result);

// if we were disposed of in the meantime, quit.
if (mHelper == null) return;


if (result.isSuccess()) {
// successfully consumed, so we apply the effects of the item in our
// game world's logic, which in our case means filling the Premium tank a bit
alert(" Consume Premium Success full",TAG,ActivityPurchaseManagedProduct.this);;
purchasePremium = null;
}
else {
complain("Error while consuming: " + result);
}

Log.d(TAG, "End consumption flow.");
}
};

关于java - 在android studio的应用程序计费中总是返回 'BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50734277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com