如何使用 API 在已 root 的手机上读取/写入 /data ?这显然是可能的,因为像 Root Explorer 这样的程序就可以做到这一点。
谢谢你,
简而言之,不,这不是strictly可以通过 API 进行,因为您需要确保修改命令以 root 身份运行,否则操作系统将拒绝这些操作。
您需要将修改命令通过管道传输到su命令以使其以 root 身份执行。 On his github https://github.com/Chainfire/libsuperuser/tree/master/libsuperuser/src/eu/chainfire/libsuperuser,Chainfire 提供了示例实现 https://github.com/Chainfire/libsuperuser/blob/master/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java of a Shell您可以用来执行的类rm命令或任何其他命令,以 root 身份执行。