如何通过 Android SDK 获得 root 权限?

编程入门 行业动态 更新时间:2024-10-26 14:36:40
本文介绍了如何通过 Android SDK 获得 root 权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在学习 Android 编程,我想制作一个必须以 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:

public static final String 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"

这是最好的方法吗?

如果无法使用 SDK,我该如何使根"应用程序正常工作?

If it's not possible using the SDK, how can I make a "root" application work?

推荐答案

你需要做的是:

Process root = Runtime.getRuntime().exec("su");

这会导致 SuperUser 显示,这让您可以从 root 访问权限中允许或阻止它.如果用户没有 root,这种方法可能不起作用.这里是一种方法你可以测试一下.

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.

更多推荐

如何通过 Android SDK 获得 root 权限?

本文发布于:2023-07-28 00:13:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:权限   Android   SDK   root

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!