Skip to content

Instantly share code, notes, and snippets.

@lithid
Created March 28, 2012 00:28
Show Gist options
  • Save lithid/2222064 to your computer and use it in GitHub Desktop.
Save lithid/2222064 to your computer and use it in GitHub Desktop.
String[] checkRom = {"gapps-geek.sh check-rom"};
String[] checkGapps = {"gapps-geek.sh check-gapps"};
// On check rom Preference
RunAsRoot(checkRom);
// On check gapps Preference
RunAsRoot(checkGapps);
public void RunAsRoot(String[] cmds){
Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
for (String tmpCmd : cmds) {
os.writeBytes(tmpCmd+"\n");
}
os.writeBytes("exit\n");
os.flush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment