大佬教程收集整理的这篇文章主要介绍了Android应用内结算 – queryInventoryAsync返回0结果,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
现在,我想查询商店以获取非拥有skus价格等信息.
这是我的活动代码:
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是“非托管”
以上是大佬教程为你收集整理的Android应用内结算 – queryInventoryAsync返回0结果全部内容,希望文章能够帮你解决Android应用内结算 – queryInventoryAsync返回0结果所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。