开发者

On Android, how long do I have to respond (and to what?) before being killed?

On Android, it is my understanding that if you don't respond to certain events from the operating system within some timeout, it will deem your application to have hung and prompt the user to kill it.

So my first question is: What, specifically, are those things? I would guess things like Activity.onPause, View.onTouchEvent, SurfaceHolder.Ca开发者_如何学编程llback.surfaceCreated, etc? Is there a list? Or is it simply every single callback that comes from the OS?

(Or is it perhaps implemented as how often some thread message queue is internally polled? Details?)

And my second question is: How long is the timeout?


If there is no response in 5 seconds, user gets the "app is not responding screen". As I see it, you have to respond anything running on the main thread in 5 seconds, otherwise the user will be prompted to kill your app.

Even worse, if the UI thread is blocked for more than a few seconds (about 5 seconds currently) the user is presented with the infamous "application not responding" (ANR) dialog.

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜