Sutirth
Sutirth

Reputation: 1267

Android: ANR Input dispatching timed out

I am getting following error logs on some phone which as follow:

Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 20. Wait queue head age: 5509.1ms.)

I am using Retrofit 2 for networking calls in which I use async method, Using database as realm where I used async transaction for writing stuff. Using Glide for image loading.

On using Strict Mode I found out I get penalty log for shared preferences nothing else. Any other pointers to see and debug issue

Upvotes: 15

Views: 20911

Answers (1)

Ratna Halder
Ratna Halder

Reputation: 2004

Any types of time expensive procedure like data syncing through network shouldn't do in main thread. Android has some default built-in methods like AsyncTask, IntentService etc. those are on worker thread. Personally I have not good idea about Retrofit 2. If it works on main thread, that case you should use it in a separate thread.

Upvotes: 1

Related Questions