android java.lang.SecurityException: Permission Denial: not allowed to send broadcast

阅读 65

2023-05-11

发送的时候添加了一个权限,所以广播接收的时候也要需要权限,才能接收到,不然就会报上面的异常

在广播的注册中文件中添加权限,如下:

<receiver android:name="com.hoperun.phone.OutgoingCallBroadcaster$OutgoingCallReceiver"
android:permission="android.permission.PROCESS_OUTGOING_CALLS">

            <intent-filter>

                <action android:name="nihaoma" />

            </intent-filter>

        </receiver>

红色的部分是必须的,否则接收不到




精彩评论(0)

0 0 举报