【问题标题】:java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.NEW_OUTGOING_CALL on android 7 (N OS)java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.NEW_OUTGOING_CALL on android 7 (N OS)
【发布时间】:2016-12-05 06:56:56
【问题描述】:

我想在 Nexus 5x(N OS) 设备上使用 adb 连接拨打电话。

我正在发送广播意图并观察到错误:

广播:Intent { act=android.intent.action.NEW_OUTGOING_CALL(有额外内容)} java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.NEW_OUTGOING_CALL from pid=5569, uid=2000 在 android.os.Parcel.readException(Parcel.java:1683) 在 android.os.Parcel.readException(Parcel.java:1636) 在 android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:3507) 在 com.android.commands.am.Am.sendBroadcast(Am.java:772) 在 com.android.commands.am.Am.onRun(Am.java:404) 在 com.android.internal.os.BaseCommand.run(BaseCommand.java:51) 在 com.android.commands.am.Am.main(Am.java:121) 在 com.android.internal.os.RuntimeInit.nativeFinishInit(本机方法) 在 com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)

【问题讨论】:

标签: android android-permissions android-7.0-nougat


【解决方案1】:

引用the documentation:

这是一个只能由系统发送的受保护意图。

因此,您不能将其用于自己的广播Intent

【讨论】:

  • 所以没有办法比实际做一个adb reboot 来测试它?
  • @JCarlosR: 我不知道NEW_OUTGOING_CALL Intentadb reboot 有什么关系。
  • 对不起,我的错(错误的页面)。我的意思是android.intent.action.BOOT_COMPLETED 为 AndroidTV 提供了相同的错误。由于它也受系统保护,因此我没有找到启动此意图的方法,不得不实际重新启动。
【解决方案2】:

使用此命令可以正常工作:

adb shell su 0 am broadcast -a android.intent.action.NEW_OUTGOING_CALL -e android.intent.extra.PHONE_NUMBER 'xxxxxxxxx'

【讨论】:

    猜你喜欢
    • 2014-07-27
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    相关资源
    最近更新 更多