在应用订阅中获得响应:-1008:未知错误

时间:2019-05-20 12:16:46

标签: android in-app-purchase in-app-billing in-app-subscription

我正在尝试实现“应用内订阅”,为此,我尝试了以下步骤

  1. 集成“ com.android.vending.BILLING”及其支持的类
  2. 在playstore中发布该应用,还复制bas64code。
  3. 为“管理产品”和“订阅”添加产品ID

“管理产品”的应用内购买正常。但是当我尝试订阅(应用内订阅)时收到错误响应 IabResult:IAB返回了空的PurchaseData或dataSignature(响应:-1008:未知错误)

代码

try{
        billingHelper.launchPurchaseFlow(activity, "sub_2", REQUEST_CODE_SUB,
                new IabHelper.OnIabPurchaseFinishedListener() {
                    @Override
                    public void onIabPurchaseFinished(IabResult result, Purchase info) {

                        if (result.isSuccess()) {
                            //TODO after subscription write code to handle success case
                            Log.e("TEST", "success purchasing: " + result);

                        } else if (result.isFailure()) {
                            //TODO handle failure case
                            Log.e("TEST", "Error purchasing: " + result);
                            return;
                        }
                    }
                });
    }catch (IabHelper.IabAsyncInProgressException e) {
        e.printStackTrace();
        Log.e("TEST", "IabHelper error  "+e);
    }

0 个答案:

没有答案