0
点赞
收藏
分享

微信扫一扫

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

墨香子儿 2023-05-11 阅读 64

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

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

<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 条评论