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

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

    I was having the same issue until I stumbled upon another SO thread. I'm including a touched up version of the code found in the other thread that you need to include in your Activity that initialises the purchase.

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    
        // Pass on the activity result to the helper for handling
        // NOTE: handleActivityResult() will update the state of the helper,
        // allowing you to make further calls without having it exception on you
        if (billingHelper.handleActivityResult(requestCode, resultCode, data)) {
            Log.d(TAG, "onActivityResult handled by IABUtil.");
            handlePurchaseResult(requestCode, resultCode, data);
            return;
        }
    
        // What you would normally do
        // ...
    }
    

提交回复
热议问题