i'm porting c++ mytoll
linux application run on android using ndk r10d. (note not android app apk
, utility tool run shell.) command line interface , has no gui , being built standalone application ndk.
on linuxes such centos 5, tool reads , writes following standard directory locations:
/var/run/mytool/ (read/write) /var/log/mytool/ (read/write) /etc/mytool/ (read only) /tmp/ (read-write)
the mytool
installed in /system/xbin/mytool
, can run on rooted android phone utility shell, fails access these same locations @ runtime, when run root
.
what corresponding locations use on android system mytool
have sufficient permissions write , such files common expected found on android? there locations can created root
such mytool
can use them @ runtime without being root
?
referring android stackexchange answer offered ferzco, settled on following solution works on rooted samsung galaxy s4:
/var/run/mytool/ => /data/log/mytool/run/ /var/log/mytool/ => /data/log/mytool/log/ /etc/mytool/ => /etc/mytool/ /tmp/ => /data/local/tmp/mytool/
i used /data/log/mytool
base 2 of directories , /data/local/tmp
third because ones find offered write permission mytool
when not su
(ed) root
. needed root
set mytool
subdirectories during installation, once mytool
directories created , chmod 777 mytool
root
, user no longer needs root
write subdirectories. fourth, /etc/mytool
, because mytool
needs read information /etc
@ runtime, left in existing /etc
directory since readable (although not writable) user once created , able configure required front root
.