当前位置:   article > 正文

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn‘t being re_registerreceiver报错

registerreceiver报错

Android apk 今天在 三星24Ultra 这台机上报错

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
  • 1

在腾讯的BUGLY(https://bugly.qq.com/)崩溃日志平台搜集到的错误如下:
在这里插入图片描述

针对这个问题去查资料,详见:
Android14 registerReceiver注册广播时报错

其实就在registerReceiver函数的第三个参数写上RECEIVER_EXPORTED或者RECEIVER_NOT_EXPORTED

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    activity.registerReceiver(this, intentFilter, Context.RECEIVER_EXPORTED);
} else {
    activity.registerReceiver(this, intentFilter);
}
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述这样就解决了,注销广播的方法不用改

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号