嘿,朋友们,我稍微修改了Android In-App-Billing SDK文章中的地下城例子。我在处理RESTORE_TRANSACTIONS请求时遇到了问题。我首先做了一个合法的购买,这很好,我接到了一个onPurchaseStateChange的电话,没有问题。然而,当我尝试使用RESTORE_TRANSACTIONS请求时,我希望得到一个构造的已验证的购买列表,但是当我跟踪它时,返回的JSON被验证得很好,但不包含任何事务!在Security.java的地下城示例中,您可以在verifyPurchase方法中看到以下代码:
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的REQUEST_PURCHASE一样返回一个经过验证的购买列表吗?
发布于 2011-06-07 12:30:48
不要紧,我得看得更仔细些。RESTORE_TRANSACTIONS旨在与托管产品ids一起使用。我正在购买一个非托管项目。
http://developer.android.com/guide/market/billing/billing_admin.html#billing-purchase-type
https://stackoverflow.com/questions/6256048
复制相似问题