本文介绍了Gdx-Pay支票购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经完成了IAP系统的设置,但是我不知道如何检查用户是否真正拥有/已经购买了某种产品.使用Android的Google IAP帐单,我确实做到了:
I've finished setting up my IAP system but I can't figure out how to check if the user actually owns/have purchased a certain product.Using Google IAP Billing for android I simply did:
Purchase ITEM_1 = inventory.getPurchase(ITEM_1);
if(ITEM_1 != null && verifyDeveloperPayload(ITEM_1)){
//Give user the product
ITEM_1_BOUGHT = true;
}
我在Gdx-Pay中找不到等效的方法.
I can't find an equivalent method for this in Gdx-Pay.
推荐答案
PurchaseObserver
具有一个名为:handleRestore(Transaction[] transactions)
您可以遍历交易:
@Override
public void handleRestore(Transaction[] transactions) {
for (int i = 0; i < transactions.length; i++) {
// do something with all bought products.
if (transactions[i].getIdentifier().equals("YOUR_PRODUCT_IDENTIFIER")) {
// do something with a certain product
}
}
}
这篇关于Gdx-Pay支票购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!