querySkuDetailsAsync Listener calls in wrong thread
See original GitHub issueI have just recently updated the latest version of the Google Billing Lib. 4.1.0
from 3.0.2.
I don’t know how exactly to define this issue but will try my best.
Now what I noticed when I call querySkuDetailsAsync
with the listener and inside this listener, I am printing products SKUs prices to the device screen,
In the newer version, an exception was thrown like Only the original view can touch its view hierarchy
as you can notice it’s like the listener just went to a background thread or its code execution is happening in the background thread.
Now you say it might be my code has something to do with it BUT actually, it’s not…
As I have downgraded to the older version its working fine with the same source code…
So it’s not really a source code problem but something with a newer version of the library.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top GitHub Comments
I think that this is actually a bug. The documentation for BillingClient says
All methods annotated with [AnyThread](https://developer.android.com/reference/androidx/annotation/AnyThread) can be called from any thread and all the asynchronous callbacks will be returned on the same thread. Methods annotated with [UiThread](https://developer.android.com/reference/androidx/annotation/UiThread) should be called from the Ui thread and all the asynchronous callbacks will be returned on the Ui thread as well.
(https://developer.android.com/reference/com/android/billingclient/api/BillingClient)And querySkuDetailsAsync is marked AnyThread, so I would expect that if you call it on the UiThread, then the callback would be called on the UiThread.
Why is this issue closed? The documentation should be updated from
to
Since that’s what I’m forced to assume it means.