Is it possible to run my program as root? I know how to run command-line native utils, but how to run Java program as root?
To run as root you have to use the command line, because that's the only way you interact directly with the linux kernel. You can however use the command line to copy your app to the /system/app/ directory, and then you have the same permissions as system apps. Also, check out RootTools .
Ofcourse you can,most android apps are made of java. Import applet or java swing and you can make what you want.
Can I make Android Apps in the C language? Google offers the native development kit (NDK) that uses native languages like C and C++ for Android development. But you can't build an entire Android app with C or C++. You need to learn Java.
This will work for you:
try {
Process process = Runtime.getRuntime().exec("su");
process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
You could use this for a command:
exec(new String[] { "su", "-c", COMMAND });
Best wishes, Tim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With