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.
In-app Billing is a Google Play service that provides checkout processing for in-app purchases. To use the service, your application sends a billing request for a specific in-app product.
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.
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