android airplane进程,通过ADB启动飞行模式(android 7)[重复](Turning airplane mode on via ADB (android 7) [duplicat...

通过ADB启动飞行模式(android 7)[重复](Turning airplane mode on via ADB (android 7) [duplicate])

这个问题在这里已有答案:

我知道这个问题已经得到了回答,就像通过亚行开启飞机模式一样。 但是,使用Android 7(Nougat)及以上建议的方法不起作用。 我得到以下错误。

eadEh.png

这有解决方法吗?

这会影响Android Nougat adb上的广播吗?

提前致谢。

This question already has an answer here:

I know this question has allready been answered like in Turning airplane mode on via ADB. However, with Android 7 (Nougat) and above the suggested methode doesn't work. I get following error.

eadEh.png

Is there a workaround for this?

Does this effect the broadcasting over adb for Android Nougat in generall?

Thanks in advance.

原文:https://stackoverflow.com/questions/43846242

更新时间:2020-02-19 12:47

最满意答案

根据Android 文档 ,似乎你不能:

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

According to Android documentation it seems you can't :

This is a protected intent that can only be sent by the system.

2017-05-08

相关问答

是的,可以通过使用猴子工具的adb shell启动应用程序。 使用此答案中的命令: adb shell monkey -p app.package.name -c android.intent.category.LAUNCHER 1

这个命令模拟应用程序图标点击,所以意图隐含的意图LAUNCHER被传递给在应用程序清单(MAIN)中声明的特定接收器 Yes, it is possible to launch an app via adb shell making use of the monke

...

你只需要在你的am start命令中添加一个带有片段名称的extra命名:android:show_fragment : am start -n com.android.settings/.Settings -e ":android:show_fragment" com.android.settings.LocalePicker

you just need to add an extra named :android:show_fragment with the fragment name to

...

请参阅问题附带的评论。 未分配变量“context”,导致Null Reference Exception。 设置Air Plane模式设置背后的逻辑没有任何问题。 See comments attached to question. The variable 'context' was not assigned, resulting in a Null Reference Exception. There isn't anything wrong with the logic behind se

...

在Android 4.2中有一个新的“设置”二进制文件你也可以不使用su来使用它,那么你的应用程序需要更改你的应用程序清单中声明的设置所需的权限(对于4.2中的飞行模式,这将是WRITE_SECURE_SETTINGS - 到安装在系统分区上的应用程序)。 启用 su

settings put global airplane_mode_on 1

am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

停用 su

s

...

我刚刚在Debian Wheezy身上遇到了这个问题。 我用sudo重新启动了adb守护进程: sudo ./adb kill-server

sudo ./adb start-server

sudo ./adb devices

一切正在工作:) The cause of that problem has to do with system permissions (thanks @ IsaacCisneros for this suggestion). Somehow HTC Wildfire

...

/**

* Gets the state of Airplane Mode.

*

* @param context

* @return true if enabled.

*/

private static boolean isAirplaneModeOn(Context context) {

return Settings.System.getInt(context.getContentResolver(),

Settings.System.AIRPLANE_MOD

...

您很可能没有为您的AndroidManifest.xml添加WRITE_SETTING权限:

还要注意代码: Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);

intent.putExtra("state", !isEnabled);

sendBroadcast(intent

...

要在基于Android的设备 (手机,平板电脑,笔记)上打开和关闭飞行/飞行模式 ,您可以执行以下操作: private final String COMMAND_FLIGHT_MODE_1 = "settings put global airplane_mode_on";

private final String COMMAND_FLIGHT_MODE_2 = "am broadcast -a android.intent.action.AIRPLANE_MODE --ez state";

@

...

这对我使用Windows 10很有用。 打开任务管理器 找到adb.exe并结束其进程 Check that you have the correct USB drivers for your Android device installed (they should either include or be downloaded with an ADB driver). If you haven't installed platform-tools, you need to do so. You

...

根据Android 文档 ,似乎你不能: 这是受保护的意图,只能由系统发送。 According to Android documentation it seems you can't : This is a protected intent that can only be sent by the system.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值