Google In App Billing不会退回任何商品

时间:2015-02-17 10:58:59

标签: android in-app-purchase in-app-billing

我现在非常绝望地在这里发布我的第一个问题:-)我做了一个应用程序并将其发布到Google Play商店。我还有一个每月订阅的应用程序内产品。现在有趣的是,从应用程序购买产品工作正常,但当我做一个queryInventoryAsync我没有得到任何产品信息作为回报。无论该人是否购买了该产品。这里是我尝试加载产品详细信息的代码

            List<String> additionalSkuList = new ArrayList<String>();
            additionalSkuList.add(PRODUCT_AD_FREE);

            mHelper.queryInventoryAsync(true, additionalSkuList,
                    new IabHelper.QueryInventoryFinishedListener() {
                        @Override
                        public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

                            if (result.isFailure() || inventory == null) {
                                // handle error
                                AsyncService.messageDialog(RemoveAdsActivity.this,"Query Inventory Failure!",SweetAlertDialog.WARNING_TYPE,null);
                                return;
                            }

                            AsyncService.messageDialog(RemoveAdsActivity.this,"Query Inventory Success!",SweetAlertDialog.WARNING_TYPE,null);

                            if (inventory.getSkuDetails(PRODUCT_AD_FREE) != null) {

                               price = inventory.getSkuDetails(PRODUCT_AD_FREE).getPrice();

                                AsyncService.messageDialog(RemoveAdsActivity.this,"Price Success!" + price, SweetAlertDialog.NORMAL_TYPE,null);

                                ((Button) findViewById(R.id.removeAdsButton)).setText(getString(R.string.remove_ads_button, price));
                            }
                        }
                    });
        }

    });

我从未收到任何产品。知道我可能做错了什么吗?订阅产品也应该通过这样的查询返回,不是吗?

在这种情况下,

getSkuDetails始终为null

这是日志:

02-17 11:50:03.497    9657-9657/net.dowalil.raceteamprincipal D/IabHelper﹕ Starting in-app billing setup.
02-17 11:50:03.507    9657-9657/net.dowalil.raceteamprincipal D/IabHelper﹕ Billing service connected.
02-17 11:50:03.507    9657-9657/net.dowalil.raceteamprincipal D/IabHelper﹕ Checking for in-app billing 3 support.
02-17 11:50:03.507    9657-9657/net.dowalil.raceteamprincipal D/IabHelper﹕ In-app billing version 3 supported for net.dowalil.raceteamprincipal
02-17 11:50:03.527    9657-9657/net.dowalil.raceteamprincipal D/IabHelper﹕ Starting async operation: refresh inventory
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Querying owned items...
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Package name: net.dowalil.raceteamprincipal
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Calling getPurchases with continuation token: null
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Owned items response: 0
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Continuation token: null
02-17 11:50:03.537   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Querying SKU details.
02-17 11:50:03.557   9657-10006/net.dowalil.raceteamprincipal D/IabHelper﹕ Ending async operation: refresh inventory

再次提及:购买作品。

2 个答案:

答案 0 :(得分:1)

好吧,我现在自己解决了这个问题。它的奇怪和奇怪,但triviadrive示例中使用的iabhelper似乎根本不适用于订阅,问题是产品类型设置修复到应用程序内

在我的iabhelper中我改变了这个:

// Item type: in-app item
//public static final String ITEM_TYPE_INAPP = "inapp";
public static final String ITEM_TYPE_INAPP = "subs";

然后我突然得到了订阅......好的

答案 1 :(得分:0)

我刚检查了您的许可证密钥。如果它是错误的密钥,它将创建订单并处理费用但不会注册该项目并且不会返回任何库存。在我的情况下,我使用了我的其他应用程序中的密钥,并得到了您看到的结果。一旦我将其更改为正确的密钥,一切正常。