I am trying to programmatically read / write a file in the / data directory on the root phone. First I run su to make sure my program gets superuser access, which works fine.
I can read / write files to / data thru shell execs in my program, but I get a " Permission denied " java.io.IOException when using an Android file or other APIs.
How to use the API to read / write to / data on the root phone? this is obviously possible since programs like Root Explorer do this.
Thank,
, , API, , root, .
su, root.github Chainfire Shell, rm , root.
su
Shell
rm
, , - , , , /sdcard/tmp.txt, , .
/sdcard/tmp.txt
chmod (.. chmod 777 /data/xxx.txt), . Permission denied, . , , chmod su, THAT . , , , root.
chmod
chmod 777 /data/xxx.txt
Permission denied
: How-To SU
,
Runtime.getRuntime().exec("chmod 077" +your_file_you_need_to_give_permission);