1

I am adding in-app-billing to one of my existing apps. To test this I created a draft app in google play, uploaded the new version of the apk with in-app-billing and added a product. I activated this product but I did not publish this new test app.

But while testing, on querying for the newly created SKU, the code can't find it. Will I have to publish my app for this to work? Am I doing something wrong here?

EDIT: I am using IABv3.

unlimit
  • 3,672
  • 2
  • 26
  • 34
  • Are you using IAB V2 or V3? Have you waited for a few hours? – class stacker Apr 15 '13 at 14:51
  • IABv3 and it has been days. – unlimit Apr 15 '13 at 15:00
  • You are referring to `getSkuDetails()`, then? That should work without publishing the app, as long as you "publish" the product (you said you did). Have you double checked the product name is correct? (I guess so...) – class stacker Apr 15 '13 at 15:05
  • Yeah, I have double checked. :-) – unlimit Apr 15 '13 at 15:06
  • The IAB V3 service [caches results](http://stackoverflow.com/a/14830007/1856738). It's not clear to me when it validates its cache or whether that works flawlessly. Have you tried deleting the data for all Google Play services and such? – class stacker Apr 15 '13 at 15:09
  • How do I delete the data? Will re-installing the app do? – unlimit Apr 15 '13 at 15:23
  • Go to Settings -> apps, find everything with Google in its name which could be related to licence checking (such as Google Play Services) and choose "clear data" (and maybe "clear cache" if offered). Don't delete the app. I really can't exclude the possibility that the Service gives you a cached negative response ((which it maybe cached while the product was not yet available). – class stacker Apr 15 '13 at 15:28
  • Strange. BTW, what exactly do you mean by "the code can't find it"? – class stacker Apr 16 '13 at 19:16

1 Answers1

3

I found the problem. I was using the TrivialDrive sample. I was under the impression that the code will automatically find and load all the SKUs. But after going through the documentation once again I found that I needed the pass the SKUs as a parameter.

  ArrayList skuList = new ArrayList();
  skuList.add(Product.SKU);             

  Log.d(TAG, "Setup successful. Querying inventory.");
  //mHelper.queryInventoryAsync(mGotInventoryListener);
  mHelper.queryInventoryAsync(true, skuList, mGotInventoryListener);
unlimit
  • 3,672
  • 2
  • 26
  • 34