Check Root Access with Xamarin.Android
Hey today i want to share with you a simple method to check if the device has a Root Access its very useful if you want to use a low level resources from your android device And here's the little class ExecuteAsRootBase.cs using System; using Java.Lang; using System.Collections.Generic; namespace RootAccess { public static class ExecuteAsRootBase { public static bool canRunRootCommands() { bool retval = false; Process suProcess; try { suProcess = Runtime.GetRuntime().Exec("su"); var os = new Java.IO.DataOutputStream(suProcess.OutputStream); var osRes = new Java.IO.DataInputStream(suProcess.InputStream); if (null != os && null != osRes) { os.WriteBytes("id\n"); os.Flush(); string currUid = osRes.ReadLine(); bool exitSu = false; if (null == currUid) { retval = false; exitSu = false; Console.WriteLine("Can't get root access or denied by user"); } el...