Post code. How are you giving your app root access? How are you calling the c code?
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
As far as I know, you need to execute a different process with su. Create a c/c++ program, and build it to an executable. Then call that from your app. The new process will have root. Not your current process.
This means you don't get to use jni. You'd need to communicate with an external process somehow (sockets, whatever).
If you figure out how to give your current proc root, that would be awesome. Please post that.
java.lang.Process sh = Runtime.getRuntime().exec("su -c sh");
OutputStream os = sh.getOutputStream();
//Gobble the outputs
StreamThread it = new StreamThread(sh.getInputStream());
StreamThread et = new StreamThread(sh.getErrorStream());
it.start();
et.start();
String yourProc = "yourprocname";
//Write your commands
os.write((yourProc + "\n").getBytes("ASCII"));