Search code examples
androidin-app-billingskus

Android inapp billing responseList is empty


I have defined some in app products in my app. I've uploaded the apk to the Google Play and added the inapp purchase products on the Google play.

I've got my ServiceConnection defined as followed:

ServiceConnection mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mService = IInAppBillingService.Stub.asInterface(service);
            connect();
        }
    };

The onServiceConnected function is called, the bindService returns true.

Next is the connect function.

public void connect() {
        new Thread(new Runnable() {
            public void run() {
                try {

                    // Purchase type is "inapp", as required by  API v3
                    Bundle skuDetails = mService.getSkuDetails(3, PACKET, "inapp", querySkus);

                    }

                    int response = skuDetails.getInt("RESPONSE_CODE");

                    Log.e("IAP connect", response + "");


                    if (response == 0) {
                        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
                        Log.e("size list", responseList.size()+"");
                        ...
                      }
                    }
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }).start();
}

PACKET here is set to the getPackageName(). The response code is 0 but the Log prints that the size of the list is 0. I have no idea why the list is empty, as I have entered 5 items in total to the Google Play and each of them are active. I have waited 2 days now and tested with three devices, but still no items get through.

I pretty much tried everything I can think of so any suggestions are welcome.


Solution

  • You need to publish your application to Beta/Alpha to access inapp billing functionality. It has recenty changed, but they did not announce it:)

    http://developer.android.com/google/play/billing/billing_testing.html#draft_apps

    It is worth to mention that you don't have to upload every new build to be able to test it. Just use the same versionCode and versionName, and it will work if the app is published.