Android using superuser privileges? allowing access

im trying to find a way to access superuser on android devices. basically, I want my application to be able to delete system files, and therefore ask the user whether it is normal after starting the application, as in most other applications, and then what kind of code do I want to use to perform these actions? can not find a lot on google

early!

+6
android
source share
3 answers

If the device is installed on the root directory, you can use the following code to access the root shell:

try { Process process = Runtime.getRuntime().exec("su"); DataOutputStream outputStream = new DataOutputStream(process.getOutputStream()); DataInputStream inputStream = new DataInputStream(process.getInputStream()); outputStream.writeBytes(command + "\n"); outputStream.flush(); outputStream.writeBytes("exit\n"); outputStream.flush(); process.waitFor(); } catch (IOException e) { throw new Exception(e); } catch (InterruptedException e) { throw new Exception(e); } 

Where "team" is the command you want to execute.

+10
source share

If I get it right, you want to grant my root privileges. This is not possible for a standard Android image that is installed on devices. The su command does not support root change.

However, you can load the configured ROM on your device, in addition, I'm afraid that there is no solution.

+1
source share

Here you can find a clear illustration of how to get root privileges.

+1
source share

All Articles