title: Android running su within app
body: <p>When I use adb to access my device (Android 4.4.2 straight from the manufactures with their custom rom - its not a regular device - it has built in 2D barcode scanner) it goes straight to having a # which I've read means I have root access. And if I run "id" I get the following:</p>
  
  <pre><code>uid=0(root) gid=0(root) context=u:r:adbd:s0
  </code></pre>
  
  <p>However, when I run "su" from within my app and then "id" I get the following:</p>
  
  <pre><code>uid=10079(u0_a79) gid=10079(u0_a79) groups=50079(all_a79) context=u:r:untrusted_app:s0n
  </code></pre>
  
  <p>So it's clearly not running as root.
  Is my understanding all wrong, in believing that it should be running as root from within the app, or is there something else I need to do in order to get this working?</p>
  
  <p>Any advice would be much appreciated.</p>
  
  <p>Here is the code I'm currently using to run the su and id commands:</p>
  
  <pre><code>p = Runtime.getRuntime().exec("su");
              p.waitFor();
              BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
  
              String line = "";
              while ((line = reader.readLine())!= null) {
                  output.append(line + "n");
              }
  
  
              p = Runtime.getRuntime().exec("id");
              p.waitFor();
              reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
  
              line = "";
              while ((line = reader.readLine())!= null) {
                  output.append(line + "n");
              }
  </code></pre>
  
  <p>One other thing I forgot to mention - I copy the app to /system/priv-app and run it from there. Still no luck.</p>