I have setup In-App Billing for the first time using the new v3 API. It is working correctly on my devices but I have received a lot of error reports from other users.
O
There is a bug in IABHelper. The return line in the exception handler is missing, meaning it drops through and calls the success hanlder - however, mSetupDone has not been set, so further calls to the API fail. Add the return statement in as below - this will still fail, but the failure will be correctly reported to your app so you can take appropriate action.
catch (RemoteException e) {
if (listener != null) {
listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
"RemoteException while setting up in-app billing."));
}
e.printStackTrace();
return; // This return line is missing
}
if (listener != null) {
listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
}