How do I request root access in Android?

Michell Bak picture Michell Bak · Sep 3, 2011 · Viewed 48.9k times · Source

I need to get root access for rooted devices, and I was wondering how I can request root access. I need the access for the file system. Thanks a lot.

Answer

dacwe picture dacwe · Sep 3, 2011

Just exec the command su and within that Process you have root priviliges:

Process p = Runtime.getRuntime().exec("su");

See this blog post for full example.