赞
踩
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);
}
这样就解决了,注销广播的方法不用改
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。