Android 10.0 11.0framework普通app发隐式广播受到限制的解决方案

在android 8.1后隐式广播收到的限制,一定要指定包名才能发送出来。像以前那种发送隐式广播就接收不到了
如:sendBroadcast(new Intent(“com.android.test.api”)); 在其他的app中就收不到广播了
必须加上包名
如下加上广播包名 类名

Intent intent = new Intent("com.android.test.api");
intent.setComponent(new ComponentName("com.android.test.myreceiver","com.android.test.myreceiver.MyBroadcastReceiver"));
sendBroadcast(intent);

而系统对于广播的

猜你喜欢

转载自blog.csdn.net/baidu_41666295/article/details/124563010