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

前端 未结 19 759
星月不相逢
星月不相逢 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:08

    Really annoying issue. Here is a quick and dirty solution that is not perfect code wise, but that is user friendly and avoids bad ratings and crashes:

    if (mHelper != null) {
            try {
            mHelper.launchPurchaseFlow(this, item, RC_REQUEST, mPurchaseFinishedListener, "");
            }       
            catch(IllegalStateException ex){
                Toast.makeText(this, "Please retry in a few seconds.", Toast.LENGTH_SHORT).show();
            }
        }
    

    This way the user just has to tap another time (2 times at worst) and gets the billing popup

    Hope it helps

提交回复
热议问题