code: private void startSetupIabAsync(final String packageName, final OnIabSetupFinishedListener listener) {
          new Thread(new Runnable() {
              @Override public void run() {
                  try {
                      Logger.d("Checking for in-app billing 3 support.");
  
                      // check for in-app billing v3 support
                      int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                      if (response != BILLING_RESPONSE_RESULT_OK) {
                          if (listener != null) listener.onIabSetupFinished(new IabResult(response,
                                  "Error checking for billing v3 support."));
  
                          // if in-app purchases aren't supported, neither are subscriptions.
                          mSubscriptionsSupported = false;
                          return;
                      }
                      Logger.d("In-app billing version 3 supported for ", packageName);
  
                      // check for v3 subscriptions support
                      response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                      if (response == BILLING_RESPONSE_RESULT_OK) {
                          Logger.d("Subscriptions AVAILABLE.");
                          mSubscriptionsSupported = true;
                      } else {
                          Logger.d("Subscriptions NOT AVAILABLE. Response: ", response);
                      }
  
                      mSetupDone = true;
                  } catch (RemoteException e) {
                      if (listener != null) {
                          listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                                  "RemoteException while setting up in-app billing."));
                      }
                      Logger.e("RemoteException while setting up in-app billing", e);
                      return;
                  }
  
                  if (listener != null) {
                      listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
                      Logger.d("Setup successful.");
                  }
              }
          }).start();
      }
docs: Performs Iab setup with the mService object which must
  be properly connected before calling this method.