-2

I am trying to find a solution for Application Not Responding (ANR) error when my app is in background. I want any ANR not to occur when my app is not in foreground. How this can be achieved? Thanks in advance.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
NS.
  • 98
  • 1
  • 13

1 Answers1

3

From Google docs:

Android will display the ANR dialog for a particular application when it detects one of the following conditions:

  • No response to an input event (such as key press or screen touch events) within 5 seconds.
  • A BroadcastReceiver hasn't finished executing within 10 seconds.

After that be sure to not do blocking/long operations on the UiThread/MainThread even if the App is in background.

emandt
  • 2,547
  • 2
  • 16
  • 20