Why does Android "TrivialDrive v3 Billing Sample" not allow multiple asynchronous calls?

I am using the utilities from Android "TrivialDrive v3 Billing Sample" and like many people I am getting the error:

java.lang.IllegalStateException: Unable to start asynchronous operation (launchPurchaseFlow) because another async operation (launchPurchaseFlow) is in progress.

This has been covered on a number of threads (like here or here ), and all places are suggesting try / catch or changing the "async operation running" state to avoid this failure.

These approaches don't make sense to me as the former requires me to implement retry mechanisms / errors in my application, and the latter tinkers with this library thread (you might as well remove that "").

My question is , what is the reason for the "1 asynchronous operation at a time" limitation in IabHelper?

If there is a real reason, then perhaps each method should throw an error that will force the developer to turn to it. If it doesn't, I think removing the "throwing illegal state ..." code should be removed.


source to share

All Articles