What is the difference between ANR and crash in Android?

前端 未结 13 2168
北海茫月
北海茫月 2020-12-07 22:56

I have searched on the internet regarding what an ANR is. And I studied those references as well. But I don\'t get details regarding a crash in Android.

Can someone

相关标签:
13条回答
  • 2020-12-07 23:39

    Application Not Responding (ANR):

    ANR will display in the following conditions:

    • Response to the input event (such as key press or screen touch even) within 5 Sec.

    • A Broadcast Receiver hasn’t finished executing within 10 Sec.

    How to avoid ANRs?

    • Create a different worker thread for long running operations like database operations, network operations etc.

    Reinforce Responsiveness: In android app usually, 100 to 200 ms is the threshold beyond which user will feel that app is slow. Following are the tips through which we can show application more responsive.

    • Show progress dialog whenever you are doing any background work and a user is waiting for the response.

    • For games specifically, do calculations for moves in the worker thread.

    • Show splash screen if your application has time-consuming initial setup.

    Crash: The crash is unhandled condition into the application and it will forcefully close our application. Some of the examples of crashes are like Nullpointer exception, Illegal state exception etc.

    0 讨论(0)
提交回复
热议问题