title: Android In App Billing "Billing service unavailable on device. (response: 3:Billing Unavailable)"
body: <p>I built and android game which has a premium in app purchase, and I had it working fine for a while. (The game was in a beta testing branch, and users could purchase the premium upgrade fine.) </p>
  
  <p>A few days ago I decided to rewrite the project, so I could clean up my code a bit. Everything seemed to work fine. (Play Game Services and AdMob Ads still work) However, in app billing no longer works. Every time my app start I receive an error: <code>"Billing service unavailable on device. (response: 3:Billing Unavailable)"</code> I've searched around everywhere, and found plenty of people having this issue, but none of their answers helped me. </p>
  
  <p><strong>I've tried:</strong></p>
  
  <ul>
  <li>Clearing the cache of the Google Play app, and accepting the terms by starting the app.</li>
  <li>Trying multiple users on my phone. (All of which were added to the testers list in the developer console.)</li>
  <li>Testing on at least 3 other (non-rooted) devices.</li>
  <li>Double checking that the <code>"com.android.vending.BILLING"</code> permission is in my manifest file.</li>
  <li>Using the same keystore to sign my new application.</li>
  <li>Using the same exact namespace for my new project.</li>
  <li>Trying 3 different play store versions.</li>
  </ul>
  
  <p><strong>Here is my iabHelper code.</strong></p>
  
  <pre><code>String base64EncodedPublicKey = "KEY HERE";
  
  iabHelper = new IabHelper(this, base64EncodedPublicKey);
  iabHelper.enableDebugLogging(true);
  iabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
      @Override
      public void onIabSetupFinished(IabResult result) {
          if (!result.isSuccess()) {
              Log.e(TAG, "Problem setting up in-app billing: " + result.getMessage());
              return;
          }
  
          if (iabHelper == null) return;
  
          iabHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
              @Override
              public void onQueryInventoryFinished(IabResult result, Inventory inv) {
                  if (iabHelper == null) return;
  
                  if (result.isFailure()) {
                      Log.e(TAG, "Failed to query inventory: " + result);
                      return;
                  }
  
                  Purchase premiumPurchase = inv.getPurchase("premium");
                  isPremium = (premiumPurchase != null);
  
                  if (!premium())
                      loadInterstitial();
             }
          });
      }
  });
  </code></pre>
  
  <p><strong>and my onActivityResult code</strong></p>
  
  <p>I'm pretty sure this isn't done correctly, however I don't think it's relevant to this error. (This isn't even called before I see the error while debugging.)</p>
  
  <pre><code>@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 (!iabHelper.handleActivityResult(requestCode, resultCode, data)) {
          if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED)
              gameHelper.disconnect();
          gameHelper.onActivityResult(requestCode, resultCode, data);
          super.onActivityResult(requestCode, resultCode, data);
      } else {
          Log.i(TAG, "onActivityResult handled by IABUtil.");
      }
  }
  </code></pre>
  
  <p>I don't normally like having to ask for help, as the answer is normally accessible online somewhere. However, I've been at this for a few days now, and I've already ripped out all the hair I have. Thanks for any help you can offer.</p>
  
  <p>My best guess at the moment is that I forgot to copy something from the original project, which is causing it to fail, but I can't think of anything besides the base64EncodedPublic key, my keystore, and the use of the same namespace. Am I missing something?</p>