Skip to content

Instantly share code, notes, and snippets.

@angad
Created May 16, 2011 17:49
Show Gist options
  • Save angad/974946 to your computer and use it in GitHub Desktop.
Save angad/974946 to your computer and use it in GitHub Desktop.
Process p;
try {
p = Runtime.getRuntime().exec("su");
try {
p.waitFor();
if (p.exitValue() != 255) {
// TODO Code to run on success
Log.v("Sample_LIBPCAP_DEBUGGING", "ROOT");
}
else {
// TODO Code to run on unsuccessful
Log.v("Sample_LIBPCAP_DEBUGGING", "NOT ROOT");
}
} catch (InterruptedException e) {
// TODO Code to run in interrupted exception
Log.v("Sample_LIBPCAP_DEBUGGING", "NOT ROOT");
}
}
catch (IOException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment