iteratehq / iterate-android

Iterate Android SDK
MIT License
3 stars 1 forks source link

[Bug] The SDK blocks the main thread when showing a survey #87

Open maciejsurmacz opened 1 week ago

maciejsurmacz commented 1 week ago

When requesting a survey through a call to sendEvent, the SDK will temporarily block the main thread till the survey is shown on screen. This is especially evident when the network is slow. I attach a video of a sample app running on an emulator (API 34, network set to UMTS/poor). Notice the loading spinner animation stopping.

https://github.com/iteratehq/iterate-android/assets/169031533/43c2aee5-43e9-4d99-989a-759c22480c7b

Here's the code for the sample app (I noticed the same behaviour in our production app which we are trying to integrate with the SDK).

From my testing, it seems that the freeze happens between the DISPLAYED event being fired and the survey being shown on the screen.

I am testing the 1.3.0 version of the SDK.

Here's a choreographer log when this happens:

2024-06-26 17:10:37.027 5844-5844 Choreographer com.example.iteratetest I Skipped 306 frames! The application may be doing too much work on its main thread.