'Android Rooted phone give write access to Android/data

I am just trying to build a basic app that can write to any file on the phone. The Galaxy I am using is rooted.

I gave full super user rights with Super-utilisateur app. I am trying using Runtime.getRuntime().exec(su -c touch /data/user/0/com.XXXX/test But it's not working.

When I do the exact same command in adb shell with the superuser right it does work.

How can I make my very simple app write to any directories on my android phone?

Just to be clear I do not intend to upload that app in the play store, it's just for testing purposes.

The end goal is to write a execute as su a small sh script written in /sdcard/ that moves files around for testing.

Thank you

I was expecting my bash script to run as root with su -c sh /sdcard/test.sh



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source