0
点赞
收藏
分享

微信扫一扫

自定义广播不进入onReceived方法


根据资料,原来是Android8.0导致的。以前直接使用Intent设置action就可以了,现在要这样:

sendBroadcast(Intent(this@MainActivity, MyBroadcastReceiver::class.java)
.setAction("MY_BROADCAST"))

 

参考:

​​https://stackoverflow.com/questions/49197282/how-to-send-a-custom-broadcast-action-to-receivers-in-manifest?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa​​

举报

相关推荐

0 条评论