我是 Java 和 android 開發的新手。我有一個應用程式,我需要使用 Anjlab 庫購買歷史記錄。在 git 上我找到了這個頁面
https://github.com/anjlab/android-inapp-billing-v3
它提到了以下內容:
BillingProcessor bps;
bps = BillingProcessor.newBillingProcessor(this, getResources().getString(R.string.play_console_license), this);
public List<BillingHistoryRecord> getPurchaseHistory(String type, Bundle extraParams)
我不熟悉如何使用
public List<BillingHistoryRecord> getPurchaseHistory(String type, Bundle extraParams)
我不完全確定如何使用它。
我的目標是列印交易歷史記錄,例如令牌和訂單 ID 等
謝謝你
uj5u.com熱心網友回復:
要獲取令牌,您可以執行以下操作:
BillingProcessor bps;
bps = BillingProcessor.newBillingProcessor(this, getResources().getString(R.string.play_console_license), this);
bps.loadOwnedPurchasesFromGoogle();
bps.getPurchaseListingDetails("yourproductcode");
String token = Objects.requireNonNull(bps.getSubscriptionTransactionDetails("yourproductcode")).purchaseToken;
您可能希望圍繞此添加空檢查
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/328247.html
