我有一个包含 4 个Managed
In App Purchases 并使用 In App Billing API v3 的应用程序。购买工作正常。为了恢复购买,当我调用getPurchases(...)
它时不会显示任何拥有的 SKU。
以下是代码片段:
Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
int response = ownedItems.getInt("RESPONSE_CODE");
alert("response " + response);
ArrayList ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
ArrayList purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
ArrayList signatureList = ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE");
String continuationToken = ownedItems.getString("INAPP_CONTINUATION_TOKEN");
alert("ownedSkus " + ownedSkus);
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = (String) purchaseDataList.get(i);
String signature = (String) signatureList.get(i);
String sku = (String) ownedSkus.get(i);
alert("PURACHSED ITEM " + i + " === " + sku);
// do something with this purchase information
// e.g. display the updated list of products owned by user
}
有没有人经历过类似的事情?我错过了什么吗?
任何帮助表示赞赏!