What are the possibilities to get this error code 3 in InApp purchase?

RajaReddy PolamReddy picture RajaReddy PolamReddy · Jan 13, 2014 · Viewed 34.6k times · Source

I am using InApp V3 code for in-app purchases in my application , i am getting this error BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE and error value :3 when Google account is not available in device. I want to know is there any other possibilities to get this error, because when i get this error i need show a popup to the user with some data. If this is causing because of Google account not available on device i will show the dialog with related text. this is the code i am using

mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
    public void onIabSetupFinished(IabResult result) {              
        if (!result.isSuccess()) {
                // error here               
            return;
        }
    }
});

this is the error Error checking for billing v3 support. (response: 3:Billing Unavailable)

Answer

Carlos Robles picture Carlos Robles · Jan 22, 2014

As we can see directly in the code of the setup of the IabHElper of the sample provided by google, the error means:

"Billing service unavailable on device."

As you can read here that error means

Billing API version is not supported for the type requested

This is the In-app Billing Reference (IAB Version 3), so the error means that the IAB v3 is not installed on the device.

Actually this means that the user has a google account, and probably also an in-app billing service, but it doesnt has the last version. This happens in old devices, and where the user never update anything, it uses to be devices where you can see the old Market app instead of the Play app.

So the error you have to show to the user, and the test that you have to perform is not if the device has a google acount, but if it has the google play services installed and properly updated.

UPDATE:

If you look for the code in all the library SDK, and the helper classes provided by google, the only place where we can find that exactly in the function that you are calling: the startSetup of the IabHelper class

Intent serviceIntent = new Intent(
                "com.android.vending.billing.InAppBillingService.BIND");
        if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0)
                .isEmpty()) {
            // service available to handle that Intent
            mContext.bindService(serviceIntent, mServiceConn,
                    Context.BIND_AUTO_CREATE);
        } else {
            // no service available to handle that Intent
            mServiceConn=null;
            if (listener != null) {
                listener.onIabSetupFinished(new IabResult(
                        BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                        "Billing service unavailable on device."));
            }
        }

This means that the app couldnt connect to the service in the device, since the package manager doesnt even know it. Thats the only option that can trigger that error. And what means that it couldnt connect to the service? It means one of these:

  • The device doesnt has the service installed.
  • It has an old version, since we know that the latest versions of play store, uses the IAB v3.

So, your error only can mean one of this, that for you means that you have to show a mesagge to the user like "You dont have google play services installed, or you have to update it". And there is not other possibilities or getting that error.

But, if you want to make it easier for the users, you can say the they need to update the Google Play App to the last version. And that will make everything works like a charm.