Android ANR

What Triggers ANR?


In Android, application responsiveness is monitored by the Activity Manager and Window Manager system services. Android will display the ANR dialog for a particular application when it detects one of the following conditions:

  • No response to an input event (e.g. key press, screen touch) within 5 seconds
  • BroadcastReceiver hasn't finished executing within 10 seconds

How To Avoid ANR?


Thread

How To Detect ANR?


You can use StrictMode to help find potentially long running operations such as network or database operations that you might accidentally be doing your main thread.

原文地址:https://www.cnblogs.com/frydsh/p/2739956.html