Android 是否有 ADB 命令来启用/禁用移动数据?(Rooted Device)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23528824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there an ADB command to enable/disable mobile data?(Rooted Device)
提问by Patrick
I'm looking for an adb shell command to enable/disable mobile data. The app is only being tested on rooted devices so I have adb root privileges. I looked around and found that wifi can be enabled/disabled with:
我正在寻找一个 adb shell 命令来启用/禁用移动数据。该应用程序仅在有 root 权限的设备上进行测试,因此我拥有 adb root 权限。我环顾四周,发现可以通过以下方式启用/禁用 wifi:
$ adb shell svc wifi enable
$ adb shell svc wifi disable
These work for me but I wasn't able to find anything for mobile data.
这些对我有用,但我找不到任何关于移动数据的东西。
Any reference to a list of adb shell svc commands that can be performed would be appreciated as well. I know there's a list of key input commands from this questionand obviously I'm aware of the developer pagebut there's no mention of svc.
对可以执行的 adb shell svc 命令列表的任何引用也将不胜感激。我知道这个问题有一个关键输入命令列表,显然我知道开发人员页面,但没有提到 svc。
Lastly, what is svc?
最后,什么是svc?
回答by Patrick
I found the answer to my question:
我找到了我的问题的答案:
To enable mobile data:
要启用移动数据:
$ adb shell svc data enable
To disable mobile data:
要禁用移动数据:
$ adb shell svc data disable