Android8.1 两个独立app间静态广播的发送与接收
Android8之后取消了大部分的静态广播的注册,可以参考广播限制,使用以前发送广播的方式是不能够调起注册的静态广播的。这里直接用跨进程(两个APP)通信的方式进行展示,在同一个进程中也是一样的:
1 ) 接收广播app1的manifest配置:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ff.calendar">
<receiver
android:name="com.ff.auto.calendar.NetStateBroadcast"
android:exported="true">
<intent-filter>
<action android:name="com.ff.calendar.action.FIVE_FINGER"/>
</intent-filter>
</receiver>
2 ) 发送广播app2:
Intent intent = new Intent("com.ff.calendar.action.FIV