admin管理员组文章数量:1642471
1. 发送广播/接收广播出现ANR
如:
01-01 18:53:21.392 W/BroadcastQueue( 2589): Timeout of broadcast BroadcastRecord{18162c1 u-1 android.intent.action.XXX_XX} - receiver=android.os.BinderProxy@5656678, started 10002ms ago
01-01 18:53:21.392 W/BroadcastQueue( 2589): Receiver during timeout of BroadcastRecord{18162c1 u-1 android.intent.action.XXX_XX} : BroadcastFilter{de5b897 10081/u0 ReceiverList{8e457e6 22351 com.android.aaa/10081/u0 remote:5656678}}
01-01 18:53:21.993 W/BroadcastQueue( 2589): Skipping deliver [foreground] BroadcastRecord{18162c1 u-1 android.intent.action.XXX_XX} to ReceiverList{d139c53 7589 com.android.xxx2//11312/u0 remote:c867686}: process gone or crashing
出现了发出广播10s了,但是Receiver没有及时响应(ANR), 则有可能在
(1) com.android.aaa 的 onReceive 方法中,做了一些耗时操作,或者这个应用占用资源过多, 导致无法及时在onReceive() 方法中结束并返回。
这个时候,onReceive 应该做一些简单的操作,例如启动一个Service 处理,然后返回。
(2) 系统正在忙(CPU),例如Binder 挂掉了
(3) 应用内存泄漏了
参考:
https://stackoverflow/questions/6535664/timeout-of-broadcast-broadcastrecord
https://stackoverflow/questions/8962600/whats-the-error-in-my-logcat
版权声明:本文标题:Android 四大组件之 BroadcastReceiver_5常见问题 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1729332512a1196573.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论