[Solved] To use sudo feature, what should I wrote in the my application?

Assuming the device is rooted and your app has been granted superuser permissions, you can use the following method to run commands as root: public static void runAsRoot(String[] cmds){ Process p; try { p = Runtime.getRuntime().exec(“su”); DataOutputStream os = new DataOutputStream(p.getOutputStream()); BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream())); for (String tmpCmd : cmds) { os.writeBytes(tmpCmd+”\n”); String … Read more