gpt4 book ai didi

Android 应用内结算 - queryInventoryAsync 返回 0 结果

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:54:05 26 4
gpt4 key购买 nike

我在应用内结算过程中遇到了一个令人沮丧的问题。我在开发控制台中创建了一个新应用程序,添加了一个名为“P1”的应用程序产品,该产品目前处于 Activity 状态;我已经将我的应用程序以 alpha 版本上传到商店,然后升级为 beta,添加了一个测试帐户,并在使用测试帐户签名的设备(平板电脑)和另一个使用开发帐户签名的设备(平板电脑)上安装了 apk。

现在,我想查询商店以获取信息,例如未拥有的 SKU 的价格。这是我的 Activity 中的代码:

private void istantiate() {
List<String> tmp = new List<String>();
tmp.add("P1");
final List<String> skus = tmp;
mHelper = new IabHelper(mContext, base64EncodedPublicKey);
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(true);
//create listener
bListener = new BillingListener(mHelper, mContext);

// Start setup. This is asynchronous and the specified listener will be called once setup completes.
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {

if (!result.isSuccess()) {
// There was a problem.
return;
}
getInventory(skus);
}
});
}

...

private void getInventory(List<String> skuList) {
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;

// IAB is fully set up. Now, let's get an inventory of stuff we own.
mHelper.queryInventoryAsync(true, skuList, bListener.mQueryFinishedListener);
}

然后当查询完成后,调用这段代码:

    IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

if (result.isFailure()) {
// handle error
return;
}
...

}
};

但是退回的库存是空的。这是logcat:

     12-13 11:21:36.977: D/IabHelper(6034): Billing service connected.
12-13 11:21:36.977: D/IabHelper(6034): Checking for in-app billing 3 support.
12-13 11:21:36.987: D/IabHelper(6034): In-app billing version 3 supported for ***
12-13 11:21:36.987: D/IabHelper(6034): Subscriptions AVAILABLE.
12-13 11:21:36.987: D/IabHelper(6034): Starting async operation: refresh inventory
12-13 11:21:36.987: D/IabHelper(6034): Querying owned items, item type: inapp
12-13 11:21:36.987: D/IabHelper(6034): Package name: ***
12-13 11:21:36.987: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Owned items response: 0
12-13 11:21:36.997: D/IabHelper(6034): Continuation token: null
12-13 11:21:36.997: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Querying owned items, item type: subs
12-13 11:21:37.097: D/IabHelper(6034): Package name: ***
12-13 11:21:37.097: D/IabHelper(6034): Calling getPurchases with continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Owned items response: 0
12-13 11:21:37.097: D/IabHelper(6034): Continuation token: null
12-13 11:21:37.097: D/IabHelper(6034): Querying SKU details.
12-13 11:21:37.097: D/IabHelper(6034): Ending async operation: refresh inventory

我的 inapp 产品发布已经有一周左右的时间了,所以这不是时间问题。我已尝试清除应用数据并重新启动设备。

编辑:使用 android.test.purchased 作为测试 sku 一切正常。
编辑 2:SKU 是“不受管理的”

最佳答案

我也遇到了这个问题,但在我清除了 Google Play 应用程序的应用程序数据后,它就得到了解决。使用亚行:

adb shell pm clear com.android.vending

关于Android 应用内结算 - queryInventoryAsync 返回 0 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27459383/

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