I can get root access via code?
You (may) can - its not as difficult as it sounds:
1. set the depending system directories to R/W instead of R/O
2. copy and install SU (SuperUser) to the system
3. execute SU and set the rights for it to root
4. allow SU to manage the root accessment
5. copy and install YOUR app to the system
6. remount the depending directories from R/W back to R/O
As you see, really simple
P.S.: i forgot: for each OS the SU differs