问题描述
是否可以在我的应用程序中以编程方式启用 USB 调试(在设置/应用程序/开发下)?
Is it possible to enable USB debugging (under settings/applications/development) programmatically from within my app?
我正在查看 Permission.WRITE_SETTINGS
和http://developer.android.com/reference/android/provider/Settings.System.html,但我找不到合适的.
I was looking at Permission.WRITE_SETTINGS
andhttp://developer.android.com/reference/android/provider/Settings.System.html,but I couldn't find anything appropriate.
推荐答案
您需要根权限才能从应用程序执行此操作.
也就是说,可以通过执行以下终端命令来启用 ADB:
That said, it is possible to enable ADB by executing the following terminal commands:
setprop persist.service.adb.enable 1
start adbd
这篇博文 给出了一个很好的例子,说明如何通过 su
以升级的权限执行这些命令.
This blog post gives an excellent example of how to execute these commands with escalated permissions through su
.
这篇关于从应用程序内以编程方式启用 USB 调试(在设置/应用程序/开发下)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!