gpt4 book ai didi

android - 应用内计费问题

转载 作者:行者123 更新时间:2023-11-29 01:33:36 26 4
gpt4 key购买 nike

我正在尝试在应用程序购买中实现,但几天来一直遇到问题。当用户尝试购买时,它是成功的,但该应用程序给出了一个奇怪的错误,该错误显然可以追溯到 os build honeycomb,它阻止用户接收购买,直到他们再次单击购买按钮。

步骤:

购买

购买成功

没有消耗品

再次点击购买按钮

给定消耗品

这是我在未提供消耗品时遇到的错误:

日志标签:Finsky

日志消息 [1] 1.run:缺少 inapp:com.mybillingproblem:one_chip 的交付数据

PID/TID:26927

代码:

public void oneChip(String noVal) {
Log.v("oneChip", "Calling launch purchase flow");
bp.purchase(this, itemOne);
Log.v("oneChip", "made it through launch purchase flow");
}

bp = new BillingProcessor(this, base64EncodedPublicKey,
new BillingProcessor.IBillingHandler() {

@Override
public void onBillingInitialized() {
Log.v("chip", "billing initialized");
readyToPurchase = true;
}

@Override
public void onProductPurchased(String productId,
TransactionDetails details) {
Log.v("chip", productId + " purchased");
if (bp.consumePurchase(productId)) {
if (productId == "itemOne"
|| productId == "one_chip")
ChipUpdate.updateChipCount(2500);
}
}

@Override
public void onBillingError(int errorCode, Throwable error) {
Log.v("chip", "Error code: " + errorCode);
Log.v("chip", "Error: " + error);
}

@Override
public void onPurchaseHistoryRestored() {
for (String sku : bp.listOwnedProducts())
Log.v("chip", "Owned Managed Product: " + sku);
for (String sku : bp.listOwnedSubscriptions())
Log.v("chip", "Owned Subscription: " + sku);
}

});

注意:我使用的是应用内计费 v3 jar。我不认为这是问题所在,因为它已被推荐并且似乎是常用的包装器。

谢谢!

最佳答案

您的 Activity 的 onActivityResult() 是什么样子的?你是否有一个?通常你将结果传递给 IabHelper 的 handleActivityResult

像这样:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
// Pass on the activity result to the iab helper for handling
if (!mHelper.handleActivityResult(requestCode, resultCode, data))
{
// not handled, so handle it ourselves (here's where you'd
// perform any handling of activity results not related to in-app
// billing...
super.onActivityResult(requestCode, resultCode, data);
}
}

关于android - 应用内计费问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29906980/

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