Android in-app billing: Can't start async operation because another async operation (is in progress)

前端 未结 19 705
星月不相逢
星月不相逢 2020-12-07 10:34

I am using the IabHelper utility classes, as recommended by Google\'s tutorial, and I\'m being hit hard by this error. Apparently IabHelper can not

19条回答
  •  离开以前
    2020-12-07 11:07

    This was not easy to crack but I found the needed workarounds. Quite disappointed with Google lately, their Android web sites have become a mess (very hard to find useful info) and their sample code is poor. When I was doing some Android development a few years ago it all went so much easier! This is yet another example of that...

    Indeed IabUtil is buggy, it does not properly call off its own async tasks. The complete set of necessary workarounds to stabilise this thing:

    1) make method flagEndAsync public. It is there, just not visible.

    2) have every listener call iabHelper.flagEndAsync to make sure the procedure is marked finished properly; it seems to be needed in all listeners.

    3) surround calls with a try/catch to catch the IllegalStateException which may occur, and handle it that way.

提交回复
热议问题