我发现这个项目https://github.com/PeterCxy/LightVPN非常适合我想做的事情,但它需要root访问权限。如果我使用平台密钥对APK进行签名并将其置于system / app目录(如果设备未植根),是否有办法使这项工作成功?
public static Process run(String command) throws IOException {
ProcessBuilder builder = new ProcessBuilder("su");
Process p = builder.start();
DataOutputStream dos = new DataOutputStream(p.getOutputStream());
dos.writeBytes(command + "\n");
dos.flush();
dos.writeBytes("exit\n");
dos.flush();
return p;
}