I'm trying to use In-App billing:
mIabHelper = new IabHelper(this, BILLING_KEY); mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { @Override public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d(TAG, "Problem setting up In-app Billing: " + result); } } });
And getting the error:
Problem setting up In-app Billing: IabResult: Billing service unavailable on device. (response: 3:Billing Unavailable)
Why? Tried to clear cache of the Play Store, didn't work for me.
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).
Usually the BILLING_UNAVAILABLE error means that your Android device is running an unsupported version of Android or Play services. Other things to check when you get this error: Are you logged in to the correct Google Account on the device/emulator? Try logging out and logging back in.
Go to Android Settings > Applications (also known as Apps & notifications on some devices) > Google Play Store > Storage > tap on Clear storage and Clear cache. Repeat the same steps for Google Services framework. Try buying again. If you still have an error, try step 2.
Well we can't help you without having much information.So instead I'll try to do a checklist for you in case you missed something:
Are you testing on an emulator?Billing services should be tested on devices,BUT if you really have to test on the emulator,make sure the emulator has google play installed and set up.This is very important!
Did you set the correct permission in the manifest? (com.android.vending.BILLING)
If you are still testing the app,did you get a test app licence from the playstore, imported the level in your SDK ,set up your licence verification library? (you can follow along here: setting up
On your activity onActivityResult did you correctly handle the activity result?As seen on the example from google you should do it this way:
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data); // Pass on the activity result to the helper for handling if (!inappBillingHelper.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } else { Log.i(TAG, "onActivityResult handled by IABUtil."); } }
Also having more information could be useful, like if you are testing on the emulator or device, the device name, the android version etc...
This error indicates that you're connecting to the in-app billing service on your device, but that the service doesn't support IAB version 3. It may be that your device's version of Google Play only supports version 2 of IAB. What version of Google Play is running on your device?
Is your version of Google Play otherwise functional (e.g., can you open the Google Play store)? Sometimes, if the date on your device is off, or there is some other problem, Google Play itself can go South.
Finally, what's in your logcat output? It would be easier to provide assistance if you provided more detail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With