【Android TimeCat】ANR in com.time.cat

ANR

E/ANRManager: ANR in com.time.cat, time=428313880
Reason: Broadcast of Intent { act=android.appwidget.action.APPWIDGET_UPDATE flg=0x114 cmp=com.time.cat/com.timecat.module.master.mvp.ui.widgets.NoteWidgetProvider (has extras) }

引起这个错误的原因是,在一个BroadcastReceiver中的onReceive方法中的处理不能超过10秒,如果超过就会出现ANR错误。

所有尽量不要在onReceive中做耗时的处理,最好用Service来处理。(不要另外开启线程,因为这个线程会随着onReceive的返回而终止。)

以下在Google API中的原文:

so you should never perform long-running operations in it (there is a timeout of 10 seconds that the system allows

before considering the receiver to be blocked and a candidate to be killed). You cannot launch a popup dialog in your

implementation of onReceive().

作者:huangliop
来源:CSDN
原文:https://blog.csdn.net/huangliop/article/details/7615262
版权声明:本文为博主原创文章,转载请附上博文链接!

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器