I have android device with root and i try to implement some small app. This app need to read files from /proc/pid/net . I made it with Runtime.getRuntime().exec(new String[] { "su", "-c", "cat /proc/"+PID+ "/net/tcp6" }); but I must accept su -permission for each pid. There are some other possibilities how i can to read system files in android from my app? Something with FileReader? How can I get the su-permissions without exec -commando?
I have android device with root and i try to implement some small app.
Share
The
execcommand IS how you getsupermissions. You might be able tochmod 777the files you want and then they can likely be read via java. That, or you could move the files you want to read to the sdcard, or your apps data location and read them from there. Here is something very useful for root. You won’t have to manually use theexeccommand each time, butRootToolsdoes still useexec.I believe if you do something like:
you will get the root access.
And then you can do just:
and then you won’t have to put the
suin as long as that process is still active.Though, I haven’t done what I explained above (with the process) in quite some time, so I may be wrong. You may still have to include
sueach time. But either way, I’d recommend usingRootTools.