What are the possibilities to get this error code 3 in InApp purchase?
This error is also received after the user removes their google account from the device.
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 doesn't have the last version. This happens in old devices, and where the user never updates anything. It used 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 account, but if it has the Google Play services installed and properly updated.
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 couldn't connect to the service in the device, since the package manager doesn't even know it. That's the only option that can trigger that error. And what does it mean that it couldn't connect to the service? It means one of these:
- The device doesn't have 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 these, that for you means that you have to show a message to the user like "You don't have Google Play services installed, or you have to update it". And there are no other possibilities for 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 work like a charm.