Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Limited number of products for IAB? — Gideros Forum

Limited number of products for IAB?

PaulHPaulH Member
edited May 2014 in Plugins
Hey folks. I'm seeing something odd in iab.requestProducts() with the Google framework. I get Event.PRODUCTS_ERROR if I have more than 20 products listed when I call setProducts(). I'm trying to use 29, and I can use the first 20 or the last 20 without an error so it's not specific to any one product, but as soon as I include 21 products I get the product error. I understand Google supports far more than 20 in-app products per app. Is there a limit imposed by the Gideros IAB plugin?

I've tried creating a second instance of the IAB class, and splitting the products between the two. If a second instance of IAB is created then both fail to get the products.

Is there some trick to using more than 20 in app products with the IAB plugin?

PaulH

Comments

  • ar2rsawseenar2rsawseen Maintainer
    There should be no limit in IAB Plugin, unless there is some unknown to me limitation of Maps in Java. Most probably there is a limit of how many products you can query to Google Billing in single request.

    I will test it with more when I get home form vacation ;)
  • PaulHPaulH Member
    Thanks for another reply while on vacation! I hate to be a pain, but this is a show-stopper for me, so if there's anything I can do with the plugin code myself I'll certainly give that a try. Is there a particular java module I should look at in the plugin code? If I can see where the request is made to Google Billing I can try to split it up into multiple queries.

    PaulH

    PS - Finally gave up on getting expansion files to work. I spent a couple days picking the best of the content to get my APK file down to 49.5 MB. That still leaves the game with vastly more content that the nearest competitor of this type of game currently on the market. I thought that issue was the last roadblock to release, just needing to plug in the rest of the in-app products. I'm extremely frustrated right now, to run into another barrier to release.
  • PaulHPaulH Member
    So there's definitely a limit of 20. I've found this comment in IInAppBillingService.java, line 221:

    /**
    * Provides details of a list of SKUs
    * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
    * with a list JSON strings containing the productId, price, title and description.
    * This API can be called with a maximum of 20 SKUs.
    * @param apiVersion billing API version that the Third-party is using
    * @param packageName the package name of the calling app
    * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
    * @return Bundle containing the following key-value pairs
    * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
    * failure as listed above.
    * "DETAILS_LIST" with a StringArrayList containing purchase information
    * in JSON format similar to:
    * '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
    * "title : "Example Title", "description" : "This is an example description" }'
    */

    I'm going to try to get to know the code to see what it would take to do multiple calls to the API.

    Paul
  • ar2rsawseenar2rsawseen Maintainer
    edited May 2014 Accepted Answer
    Cannot try to run the code now, but you can try in IabGoogle.java file changing the request method:
    <a href="http://forum.giderosmobile.com/profile/Override" rel="nofollow">@Override</a>
    public void request(Hashtable<String, String> products) {
    	mHelper.flagEndAsync();
    	List<String> skuList = new ArrayList<String>();
       	Enumeration<String> e = products.keys();
    	while(e.hasMoreElements())
    	{
    		String prodName = e.nextElement();
           	skuList.add(products.get(prodName));
           }
           mHelper.queryInventoryAsync(true, skuList, this);
    }
    to something like
    <a href="http://forum.giderosmobile.com/profile/Override" rel="nofollow">@Override</a>
    public void request(Hashtable<String, String> products) {
    	mHelper.flagEndAsync();
    	List<String> skuList = new ArrayList<String>();
       	Enumeration<String> e = products.keys();
       	int i = 0;
    	while(e.hasMoreElements())
    	{
    		String prodName = e.nextElement();
           	skuList.add(products.get(prodName));
       	i++;
       	if(i == 19){
       	   	mHelper.queryInventoryAsync(true, skuList, this);
       	   	i = 0;
       	   	skuList.clear();
       	}
           }
       	if(!skuList.isEmpty())
             	   	mHelper.queryInventoryAsync(true, skuList, this);
    }
    This should split in multiple requests, but will also callback multiple events
  • PaulHPaulH Member
    Thank you! I've tried something similar in IabHelper's querySkuDetails function, breaking the skuList into sublists of up to 20 and calling getSkuDetails separately for each sublist, and combining the results into a single arrayList. So far that seems to be working, and it causes only one PRODUCTS_COMPLETE event. There may be side effects of that method though, so if I encounter any further issues I'll try your method.

    Again, thanks for looking into this on your vacation!

    Paul
  • This issue has reared its head again. One of my games has a large number of in-app products - It's a fishing simulator, and I release a new river each week. I've had the product codes in the app for some time, and I've been adding a product to the app stores for the new one each week. The code proactively had support for 240+ products, and all was fine until the number the store actually returned reached 128 products. Then the app began to crash in the querySkuDetails method again.

    Disabling some products from the store should theoretically provide a temporary fix, but changes to the app store take some time to propagate, and I won't know for a while if that worked. So I'm releasing a fix in which the app lists fewer products via IAB.

    That will get my users up and running fairly quickly, but the issue remains. I've traveled many thousands of miles around the US the last few years shooting locations for this app, and have about 100 more to release over the next two years or so. I expect to top out with at least 243 products, but I won't be able to offer more than 127 until this is fixed.

    The limit of 127 is highly suspicious. It hints strongly at a signed byte being used as an index into an array storing some data about the available products. I don't see anything like that at first glance.

    Is anyone more familiar with the underlying code in IAB, and perhaps able to shed some light on this problem?

    Paul
  • Not being of any help at all but.. that's a lot of products :)
Sign In or Register to comment.