【发布时间】:2020-07-29 19:56:07
【问题描述】:
我应该处理 onBillingSetupFinished 上的哪些状态?
我的意思是,BillingResponseCode 接口上有 12 种可能的状态:
int SERVICE_TIMEOUT = -3;
int FEATURE_NOT_SUPPORTED = -2;
int SERVICE_DISCONNECTED = -1;
int OK = 0;
int USER_CANCELED = 1;
int SERVICE_UNAVAILABLE = 2;
int BILLING_UNAVAILABLE = 3;
int ITEM_UNAVAILABLE = 4;
int DEVELOPER_ERROR = 5;
int ERROR = 6;
int ITEM_ALREADY_OWNED = 7;
int ITEM_NOT_OWNED = 8;
但我想只有少数人真正发送到这个方法,那么我应该关心他们中的哪一个?
public void onBillingSetupFinished(@NonNull BillingResult billingResult)
{
switch(billingResult.getResponseCode())
{
case BillingClient.BillingResponseCode.OK:
break;
case BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED:
break;
case BillingClient.BillingResponseCode.ITEM_NOT_OWNED:
break;
case BillingClient.BillingResponseCode.BILLING_UNAVAILABLE:
break;
case BillingClient.BillingResponseCode.DEVELOPER_ERROR:
break;
...
default:
}
}
如果我找到计费 api 的源代码会有所帮助,但我找不到。
【问题讨论】: