android - Elevate application rights to execute binary -
i trying package , execute native arm binaries within java android app version 4.0 (api level 15).
the packaging works fine, adding shell scripts , binaries assets folder of project (using android studio), deployed apk.
i follow these solutions copy assets filesystem. here first problem, seem able write getfilesdir()
not e.g. /data/local/tmp/. well, copy files application data dir (resolves /data/data/com.myapp/files/. along process, set mode of files executable.
then try execute binaries via runtime.getruntime().exec()
seems work shellscripts not binaries. can use copy binaries prefered destination via
cat /data/data/com.myapp/files/binary > /data/local/tmp/binary
note: cp wont work, permission denied. chmod 777 works again. execution not work, permission denied. assume related how paths mounted.
the whole process works when performing via adb. can see app has different user id adb, might related kernel limitations? requesting write_external_storage.
reading this implies /data/local/tmp/ should prefered destination.
the question is: (how) can elevate rights of application perform same operations done via adb.
the phone not rooted.
i solved problem executing shellscript (bundled via assets , written getfilesdir()
in oncreate() method). uses temporary root environment call other scripts have no problem reading/writing things.
why wouldnt work directly, no clue.
the script on github.
Comments
Post a Comment