我学习机器人编程,我想打它具有以root身份运行的应用程序。合乎逻辑的做法是添加在Android清单根权限。
I'm learning Android programming, and I want to make an application which has to run as root. The logical thing would be to add a root permission in the Android Manifest.
我看到的文档中此链接,特别指出的的 FACTORY_TEST
许可:
I saw this link in the documentation, and especially noted the FACTORY_TEST
permission:
公共静态最后弦乐FACTORY_TEST
自:API级别1
作为一个工厂测试运行 应用程序,运行在root用户。 仅当该设备是 在制造商测试模式下运行。 常数值: android.permission.FACTORY_TEST
Run as a manufacturer test application, running as the root user. Only available when the device is running in manufacturer test mode. Constant Value: "android.permission.FACTORY_TEST"
时,最好的方法是什么?
Is that the best way?
如果它使用SDK是不可能的,我怎样才能使一个根推广应用工作?
If it's not possible using the SDK, how can I make a "root" application work?
您需要做的是一样的东西:
What you need to do is something like:
Process root = Runtime.getRuntime().exec("su");
这会导致超级用户才能显示,它可以让你要么允许或root访问阻断它。如果用户的根源并非是这种方法可能无法正常工作。 Here是一种方式,您可以测试它。
That causes SuperUser to show, which lets you either Allow or Block it from root access. This approach might not work if the user is not rooted. Here is a way you can test it.