I am disappointed with the in-app billing process. I created a new application in the dev console, added an inapp product called "P1", which is currently active; I downloaded my application to the store in alpha, then switched to beta, added a tester account and installed apk on a device (tablet) signed with a tester account and another with a dev account.
Now, I would like to request from the store to get information, such as the price of a non-skus. Here is my code from my activity :
private void istantiate() { List<String> tmp = new List<String>(); tmp.add("P1"); final List<String> skus = tmp; mHelper = new IabHelper(mContext, base64EncodedPublicKey); // enable debug logging (for a production application, you should set this to false). mHelper.enableDebugLogging(true); //create listener bListener = new BillingListener(mHelper, mContext); // Start setup. This is asynchronous and the specified listener will be called once setup completes. mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { // There was a problem. return; } getInventory(skus); } }); } ... private void getInventory(List<String> skuList) { // Have we been disposed of in the meantime? If so, quit. if (mHelper == null) return; // IAB is fully set up. Now, let get an inventory of stuff we own. mHelper.queryInventoryAsync(true, skuList, bListener.mQueryFinishedListener); }
Then, when the request is complete, this piece of code is called:
IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() { public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (result.isFailure()) {
But the returned inventory is empty. Here logcat :
12-13 11:21:36.977: D/IabHelper(6034): Billing service connected. 12-13 11:21:36.977: D/IabHelper(6034): Checking for in-app billing 3 support. 12-13 11:21:36.987: D/IabHelper(6034): In-app billing version 3 supported for *** 12-13 11:21:36.987: D/IabHelper(6034): Subscriptions AVAILABLE. 12-13 11:21:36.987: D/IabHelper(6034): Starting async operation: refresh inventory 12-13 11:21:36.987: D/IabHelper(6034): Querying owned items, item type: inapp 12-13 11:21:36.987: D/IabHelper(6034): Package name: *** 12-13 11:21:36.987: D/IabHelper(6034): Calling getPurchases with continuation token: null 12-13 11:21:36.997: D/IabHelper(6034): Owned items response: 0 12-13 11:21:36.997: D/IabHelper(6034): Continuation token: null 12-13 11:21:36.997: D/IabHelper(6034): Querying SKU details. 12-13 11:21:37.097: D/IabHelper(6034): Querying owned items, item type: subs 12-13 11:21:37.097: D/IabHelper(6034): Package name: *** 12-13 11:21:37.097: D/IabHelper(6034): Calling getPurchases with continuation token: null 12-13 11:21:37.097: D/IabHelper(6034): Owned items response: 0 12-13 11:21:37.097: D/IabHelper(6034): Continuation token: null 12-13 11:21:37.097: D/IabHelper(6034): Querying SKU details. 12-13 11:21:37.097: D/IabHelper(6034): Ending async operation: refresh inventory
This is about a week after the release of my inapp product, so it is not a matter of time. I tried to clear the application data and restart the device.
Change Everything works fine using android.test.purchased as test sku.
Edit 2 : SKUs are unmanageable
android google-play-services in-app-billing in-app-purchase
Jd
source share