'Android in-app purchase setup keeps returning - Billing service unavailable on device. (response: 3:Billing Unavailable)

I'm trying to implement In-app billing in an app currently on google play store. I keep getting the same result for any device running the app. (I have read the tutorials and all the questions here with no help)

For testing, I am uploading a signed apk to the market, and I'm saving each billing setup result response on a server, so I can see all the user's results. (all are getting the same result - response 3). so I know it's not a problem of a device, location, google play services version etc..

I can upload some code, but basically I have been working with the tutorials so it's pretty straight forward.

some code

Permission in manifest:

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

OnActivityResult:

  @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

    // Pass on the activity result to the helper for handling
    if (mHelper == null || !mHelper.handleActivityResult(requestCode, resultCode, data)) {
        // not handled, so handle it ourselves (here's where you'd
        // perform any handling of activity results not related to in-app
        // billing...
        super.onActivityResult(requestCode, resultCode, data);

here I am doing some other stuff not related to billing

    }
    else {
        Log.d(TAG, "onActivityResult handled by IABUtil.");
    }
}

and this is how I Initialize the billing helper:

    private void InitBilling() {
        mHelper = new IabHelper(this, base64EncodedPublicKey);
    isBillingAvailable = false;
    // perform the binding by calling the bindService method
    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);


    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.e(TAG, "Problem setting up In-app Billing: " + result);

                return;
            }

            // Hooray, IAB is fully set up!
            Log.d(TAG, "In-app Billing is set up OK");
            isBillingAvailable = true;
            ArrayList<String> listOfItemsToCheck = new ArrayList<String>();
            // getting list of items..

            checkForPurchasedItems(listOfItemsToCheck);
        }
    });
}

what can cause this and how can I solve this issue? thanks in advance.



Solution 1:[1]

There are numerous cases that could lead to this problem so you need to describe what you have done so far. Some checkpoints:
- are the permissions correct in your manifest
- do you handle the response of the play services library in your onActivityResult
- are you still testing so have you entered the accounts in the testing section of your developer account

In general this indicates that either the API version on the device does not match (unlikely if you use different devices) or that the user is not allowed to use it:

Indicates that In-app Billing is not available because the API_VERSION that you specified is not recognized by the Google Play application or the user is ineligible for in-app billing (for example, the user resides in a country that prohibits in-app purchases).

BTW: testing will not work with your own developer account but you need to register test accounts.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Carsten