Android NDK superuser permissions
I have开发者_开发技巧 a C program which I can run my rooted Android phone. However, in order to work correctly, the program must be run as superuser.
I now wish to call a method from this program using the Android NDK interface. What must I do to have the native code run as superuser?
You should run the su
program, and then script it (by writing to its standard input) to run your program. On some rooted devices, this will "just work", and on others (most, really) it will spawn an activity from an app called SuperUser to ask the user if it should be allowed.
精彩评论