Я использую: bp.isSubscribeed (ID) для подтверждения моей подписки.Но когда я отменяю подписку, метод bp.isSubscribeed (ID) все еще возвращает true.Что мне делать?
transDetails.purchaseInfo.purchaseData.purchaseState.toString () Всегда возвращать купленный успешно после того, как я вручную отменил подписку в магазине воспроизведения.
public void checkSubscriptionDetails(){
bp = new BillingProcessor(this, LICENSE_KEY, new BillingProcessor.IBillingHandler() {
@Override
public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {
Common.printLog("InApp", ":onProductPurchased :" + productId);
}
@Override
public void onPurchaseHistoryRestored() {
}
@Override
public void onBillingError(int errorCode, @Nullable Throwable error) {
}
@Override
public void onBillingInitialized() {
}
});
boolean purchaseResult = bp.loadOwnedPurchasesFromGoogle();
// ## purchaseResult is always return FALSE
if (bp.isSubscribed(planID)) {
TransactionDetails transDetails = bp.getSubscriptionTransactionDetails(planID);
String strDetailsSubsMonth = "OrderID:" + transDetails.orderId +
"\nproductId: " + transDetails.productId +
"\npurchaseToken: " + transDetails.purchaseToken +
"\npurchaseTime: " + transDetails.purchaseTime +
"\npurchaseInfo.signature: " + transDetails.purchaseInfo.signature +
"\npurchaseInfo.responseData: " + transDetails.purchaseInfo.responseData +
"\npurchaseData.purchaseToken: " + transDetails.purchaseInfo.purchaseData.purchaseToken +
"\npurchaseData.autoRenewing: " + transDetails.purchaseInfo.purchaseData.autoRenewing +
"\npurchaseData.developerPayload: " + transDetails.purchaseInfo.purchaseData.developerPayload +
"\npurchaseData.purchaseState: " + transDetails.purchaseInfo.purchaseData.purchaseState.toString();
String strPurchaseState = transDetails.purchaseInfo.purchaseData.purchaseState.toString();
Common.printLog("InApp", "Details: " + planID + " >> " + strDetailsSubsMonth + " \n" + "Purchase State :" + strPurchaseState);
}
}
package com.anjlab.android.iab.v3;
public enum PurchaseState
{
PurchasedSuccessfully,
Canceled,
Refunded,
SubscriptionExpired
}
мне нужно вернуть «Отменено»при отмене подписки.