【问题标题】:android how to send a system broadcastandroid如何发送系统广播
【发布时间】:2015-04-29 08:34:19
【问题描述】:

我正在测试 android 应用的功耗 为了让应用程序消耗尽可能多的电量,我想发送一个像“android.intent.action.PACKAGE_ADD”这样的系统广播,但是当我通过 adb shell am broadcast 命令发送它时系统会重启。

那么有什么方法可以发送系统广播吗?

【问题讨论】:

  • 是什么让您认为您的问题是由“不正确”的广播发送方法引起的?

标签: android testing adb broadcast


【解决方案1】:

我想你可以在这里看到解决方案:

Some themes in StackOverflow

One simple tutorial

您可以在官方文档 developer.andorid 中查看更多详细信息

【讨论】:

  • 感谢您的回答,但我想发送一些系统广播,像“android.intent.action.CALL”这样的广播可以通过 adb shell 命令发送,但其他像“android.net.conn” .CONNECTIVITY_CHANGE" 应用无法发送,设备会重启或出现异常"java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.PACKAGE_ADDED"
  • 一些广播受到保护。请参阅:android.googlesource.com/platform/frameworks/base/+/master/core/… 也许您在 Android
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多