Bootstrap

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn‘t being re

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

在腾讯的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);
}

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

;