简体   繁体   中英

Google in-app billing,Error retrieving information from server [DF-DFERH-01]

I'm testing google's in-app billing. I follow the instruction of google in-app billing training, using the IabHelper.

I setup the IabHelper successfully.

mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            Log.d("GooglePay", "Setup finished.");

            if (!result.isSuccess()) {
                // Oh no, there was a problem.
                Log.d("GooglePay", "Problem setting up in-app billing: " + result);
                return;
            }

            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null) return;

            mBroadcastReceiver = new IabBroadcastReceiver(GooglePayPlugin.this);
            IntentFilter broadcastFilter = new IntentFilter(IabBroadcastReceiver.ACTION);
            mActivity.registerReceiver(mBroadcastReceiver, broadcastFilter);
        }
    });

Then, I call the purchase API of IabHelper.

try {
     mHelper.launchPurchaseFlow(mActivity, productID, RC_REQUEST,
                mPurchaseFinishedListener, payload);
} catch (IabAsyncInProgressException e) {
     Log.d("GooglePay", "Error launching purchase flow. Another async operation in progress.");
}

But, I always got a popup windows says: "从服务器检索信息时出错。[DF-DFERH-01]", as the following picture. 在此处输入图片说明

The logcat information is in attated.

Please check with your code with following steps:

STEP: 1 check sdk manager with sdk tool is updated with Google Play Billing Library and Google play services

STEP: 2 Create an Android project and add billing permission to your Android project's manifest file.

<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.INTERNET" />

STEP: 3 Adding the AIDL file to your project

1.By right click on you app-level folder>> Folder>> AIDL folder

2.Example for in app billing create directory or folder or package –> com.android.vending.billing

3.Then copy paste file in this package

After doing all this you will get error in other InApp billing supportive classes like IabHelper for importing that InAppBillingService.aidl, to resolve it go to build.gradle and readjust your directory for com.android.vending.billing which is not correct format at the time of com.android.vending.billing directory or package creation

like:

sourceSets { main { aidl.srcDirs = ['src/main/aidl'] } }

STEP: 3 Update dependencies in build.gradle file

STEP: 4 Initiate a Connection with Google Play

(Make sure base64EncodedPublicKey is right for your product)

( Base64EncodedPublicKey means your license key from google play console )

 /************Setting Up Google Play Billing in the Application***************/
    mHelper = new IabHelper(this, base64EncodedPublicKey);

    // enable debug logging (for a production application, you should set this to false).
    // mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(@NonNull IabResult result) {
            if (!result.isSuccess()) {
                Log.d(TAG, "In-app Billing setup failed: " + result);
                complain("In-app Billing setup failed:: " + result);

            } else {
                Log.d(TAG, "In-app Billing is set up OK");
            }
        }
    });
    /************Setting Up Google Play Billing in the Application***************/

STEP: 5

For testing purpose use following item_sku:

static final String ITEM_SKU = "android.test.purchased";
static final int RC_REQUEST = 10001;

in case of live use live ProductID which are you creating.

STEP: 6

  1. Implementing onActivityResult Method for handling result

     @Override protected void onActivityResult(int requestCode, int resultCode,Intent data) { if (!mHelper.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } } 
  2. Implementing OnIabPurchaseFinishedListener

  3. Implementing QueryInventoryFinishedListener

  4. Implementing OnConsumeFinishedListener

STEP: 7

make sure your device having updated Google play services

STEP: 8

calling the purchase API of IabHelper.

 mHelper.launchPurchaseFlow(mActivity, ITEM_SKU,
              RC_REQUEST,mPurchaseFinishedListener, mPayload);

STEP: 9 For More please reference with following link:

https://developer.android.com/google/play/billing/billing_integrate.html#billing-permission

https://developer.android.com/google/play/billing/billing_library.html#connecting

I hope this will help you.

I solved this issue eventually, put my answer here, hope it help those who met the same problem like me.

mHelper.launchPurchaseFlow(mActivity, productID, RC_REQUEST, mPurchaseFinishedListener, payload);

The "payLoad" parameter is too long, I set the payload to empty string, then the problem is sloved, no more df-dferh-01.

It's nothing to do with the VPN, nothing to do with the google library, just because the payload is too long for google play service interface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM