09 September 2010
BroadcastReceiver trigger  ANR

今天發現某支app丟出了一個ANR!

看了一下LOG!

發現是由BroadcastReceiver丟出來的!

看了一下官方ANR的有關說明!

才發現!!!

BroadcastReceiver hasn't finished executing within 10 seconds

原來一個BroadcastReceiver要在十秒之內完成,否則會丟出一個ANR!

雖然我知道一個long operation盡量在service中完成,

但我不知道BroadcastReceiver的限制time out 這麼短!!!

BroadcastReceiver的說明文件中也有提到!

(there is a timeout of 10 seconds that the system allows before considering the receiver to be blocked and a candidate to be killed

所以大家在send Broadcast,大家要注意一下了!!







blog comments powered by Disqus