安卓开发学习问题13:background execution not allowed: receiving Intent
问题描述环境是:API32,最小SDK是26,发送广播,本App都无法接收,日志出现错误:background execution not allowed: receiving Intent { act=hello flg=0x10 (has extras) } to com.example.brocast_page/com.example.reciver.MyReciver原因分析target&
·
问题描述
环境是:API32
,最小SDK
是26
,
发送广播,本App
都无法接收,日志出现错误:
background execution not allowed: receiving Intent { act=hello flg=0x10 (has extras) } to com.example.brocast_page/com.example.reciver.MyReciver
原因分析
target>=26
时,APP
发送的静态广播连自己也收不到
问题解决
对于隐式广播,如果没有包含FLAG_RECEIVER_INCLUDE_BACKGROUND
不允许被接收,而源码中,提供的该字段为
所以自行添加
intent.addFlags(0x01000000);
更多推荐
已为社区贡献10条内容
所有评论(0)