Pick the fix
An analytics SDK uploads each event immediately on the calling thread. Apps report jank and ANRs. Fix?
Hint 1 of 1
Should logging an event wait for the network?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Queue events to disk and upload batches in the background with WorkManager
Correct. Calls return at once and uploads are batched.
Why not the others?
- B Upload on a new Thread per event. Too many threads and requests.
- C Make the API a suspend function. Pushes the problem onto every caller.
- D Drop all events. Defeats the purpose.