关于Android8及以上版本自定义广播无法接收问题

高版本Android直接发送广播是无法接收的

e.g.

1 sendBraodcast(intent);

需要在前面加上(前一个String为项目地址,后一个为广播类的地址)

1 intent.setComponent(new ComponentName("com.example.broadcasttest","com.example.broadcasttest.MyBroadcastReceiver"));

猜你喜欢

转载自www.cnblogs.com/XianghaoWang/p/10741536.html