Android应用程式内账单空JSON RESTORE_TRANSACTIONS! [英] Android In-App-Billing RESTORE_TRANSACTIONS with empty JSON!

查看:131
本文介绍了Android应用程式内账单空JSON RESTORE_TRANSACTIONS!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计们,
我稍微修改为Android应用内账单SDK文章地牢例子。我有与RESTORE_TRANSACTIONS要求的麻烦。我首先要合法购买和去很好,我接到一个电话,没有问题onPurchaseStateChange。然而,当我尝试使用RESTORE_TRANSACTIONS要求,我期待得到购买的构造核实名单,但是当我跟踪它时,返回的JSON验证就好了,但不包含交易!在Security.java在地牢里比如你看到verifyPurchase方法这个code:

Hey folks, I am slightly modified the dungeons example for the Android In-App-Billing SDK article. I am having trouble with the RESTORE_TRANSACTIONS request. I first make a legitimate purchase and that goes fine, I get a call to onPurchaseStateChange with no issue. However, when I try to use RESTORE_TRANSACTIONS request, I was expecting to get a constructed verified list of purchases, but when I trace it, the JSON returned is verified just fine, but contains no transactions! Within Security.java in the Dungeons example you see this code in the verifyPurchase method:

    if (Consts.DEBUG) {
        Log.d(TAG, "Parsing JSON object");
    }
    JSONObject jObject;
    JSONArray jTransactionsArray = null;
    int numTransactions = 0;
    long nonce = 0L;
    try {
        jObject = new JSONObject(signedData);

        // The nonce might be null if the user backed out of the buy page.
        nonce = jObject.optLong("nonce");
        jTransactionsArray = jObject.optJSONArray("orders");

        if (jTransactionsArray != null) {
            numTransactions = jTransactionsArray.length();
        }

        if (Consts.DEBUG) {
            Log.d(TAG, "JSON Array has " + numTransactions + " transactions");
        }
    } catch (JSONException e) {
        if (Consts.DEBUG) {
            Log.d(TAG, e.getMessage());
        }
        return null;
    }

我误解了RESTORE_TRANSACTIONS的目的是什么?是不是应该退回购买的验证列表就像通过onPurchaseStateChange?

Am I misunderstanding the purpose of the RESTORE_TRANSACTIONS? Isn't it supposed to return a verified list of purchases just like REQUEST_PURCHASE through the onPurchaseStateChange?

推荐答案

没关系,我要看看更接近。该RESTORE_TRANSACTIONS是为了与管理产品的IDS使用。我购买的非托管的项目。

Nevermind, I have to look much closer. The RESTORE_TRANSACTIONS is meant to be used with MANAGED product ids. I was purchasing an UNMANAGED item.

http://developer.android.com/guide/market/billing/billing_admin.html#billing-purchase-type

这篇关于Android应用程式内账单空JSON RESTORE_TRANSACTIONS!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆