有没有办法获取应用中所有消费项目的列表。
如果我跑:
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished.");
if (result.isFailure()) {
Log.e(TAG, "#### IAP Error: Failed to query inventory: " + result);
return;
}
Log.d(TAG, "#### IAP Query inventory was successful.");
// Check for inApp-Items to consume (not subs)
//getSkuDetails(): type: Value must be 'inapp' for an in-app product or 'subs' for subscriptions.
if(!inventory.getAllPurchases().isEmpty()){
Log.d(TAG, "#### IAP 1");
int count = 0;
for(Purchase p : inventory.getAllPurchases()){
count += 1;
Log.d(TAG, "#### IAP 2");
Log.d(TAG, "#### IAP Inventory Item" + count + "=" + p.toString());
if(inventory.getSkuDetails(p.getSku()).getType().equals(IabHelper.ITEM_TYPE_INAPP)){
mHelper.consumeAsync(inventory.getPurchase(p.getSku()), mConsumeFinishedListener);
}
}
}
// if (inventory.hasPurchase("android.test.purchased")) {
// Log.d(TAG, "**** IAP We have android.test.purchased. Consuming it.");
// mHelper.consumeAsync(inventory.getPurchase("android.test.purchased"), mConsumeFinishedListener);
// return;
// }
//updateUi();
//setWaitScreen(false);
Log.d(TAG, "#### IAP Initial inventory query finished; enabling main UI.");
}
};
我收到了一份包含所有非消费品而非消费品的库存 但是我查找了一个列表,其中显示了用户从我的应用程序中获取的所有消费项目。
有人可以告诉我是否有办法吗?