使用Google Play商店在应用结算中设置v3

时间:2014-07-09 17:42:35

标签: android in-app-billing google-play

我按照本教程的步骤在app billing v3中设置了一个项目:

http://developer.android.com/training/in-app-billing/preparing-iab-app.html http://developer.android.com/google/play/billing/billing_integrate.html

我遇到的问题是,当我要求产品的详细信息执行以下操作时:

索取产品详情

ArrayList<String> appIdList = new ArrayList<String>();
appIdList.add("tn38g");
appIdList.add("f4zn");
appIdList.add("kjecm");
appIdList.add("1j16a");
mHelper.queryInventoryAsync(true, appIdList, mQueryFinishedListener);

接听回电

IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {

    @Override
    public void onQueryInventoryFinished(IabResult result, Inventory inv) {

        if(result.isFailure()){
            Log.d(getClass().getSimpleName(), "Shop Query Failiure!");              

        } else {

            List<SkuDetails> listOfItems = inv.getSkuList();
            for (int i = 0; i < listOfItems.size(); i++) {
                SkuDetails details = listOfItems.get(i);
                Log.d(getClass().getSimpleName(), "details.getTitle() = " + details.getTitle());
                Log.d(getClass().getSimpleName(), "details.getPrice() = " + details.getPrice());
            } 
            SkuDetails details = inv.getSkuDetails(mCustomerHasDocuments.getIssue().getAppstoreIdentifier());

            Log.d(getClass().getSimpleName(), "details = " + details);

            if(details != null){
                price = details.getPrice();
            }
            populateButtons();
        }
    }
}; 

即使具有相同产品ID的产品位于Google Play开发者控制台中,回拨始终会返回没有任何产品详情的广告资源。

有同样问题的人吗?什么可能是错的?

任何帮助都将不胜感激。

这些是日志:

07-09 19:31:22.962: D/PublicationDetailView(28874): success at Shop Setup!

07-09 19:31:23.742: D/(28874): QueryInventoryFinishedListener
07-09 19:31:23.742: D/(28874): result.getMessage = Inventory refresh successful. (response: 0:OK)
07-09 19:31:23.742: D/(28874): result.getResponse = 0
07-09 19:31:23.742: D/(28874): result.isSuccess = true
07-09 19:31:23.742: D/(28874): listOfItems.size() = 0
07-09 19:31:23.742: D/(28874): details = null

1 个答案:

答案 0 :(得分:1)

尝试使用真实的信用卡。但是,您可以随时退还测试购买资料!

请注意,您必须从与开发者帐户分开的测试帐户进行购买,因为Google Checkout不允许帐户自行购买。