title: Running native code on Android with root permissions
body: <p>I'm using the Video For Linux 2 API from my Android app's native library to talk to the Qualcomm FM radio chipset in my rooted Xperia E C1504, and I need to run my native library's code with root privileges in order to access /dev/radio0 with write permission before I can begin issuing (successful) ioctl.h commands.  Specifically, I'm fairly sure I need the fcntl.h function call: </p>
  
  <pre><code>int device_fd = open("/dev/radio0", O_RDWR);
  </code></pre>
  
  <p>to not throw a 'permission denied' error.  I know how to issue shell commands as SU, but how can I obtain root privileges for the entire scope of my native library's execution?  <a href="https://stackoverflow.com/questions/9194725/run-android-program-as-root">This post</a> suggests that installing my app in the /system/app directory should grant the permissions I need, but I tried it and still receive errno 13 (permission denied) when I try to open the target device in read/write mode.</p>