title: Android app: allowing socket access for a program
body: <p>I am trying to develop an app which calls a external program (written in C) using the Runtime.getRuntime().exec method. This program is basically an gstreamer-based <a href="http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol" rel="nofollow">RTSP</a> server, and it works good if I run from the Android command prompt. However, when I run the program from the app, I am getting the following error.</p>
  
  <blockquote>
    <p>Failed to bind socket (Permission denied)</p>
  </blockquote>
  
  <p>I had given the network access in my AndroidManifest.xml file.</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
  </code></pre>
  
  <p>I also tried this:</p>
  
  <pre><code>String cmd = "ping localhost";
  Runtime.getRuntime().exec(cmd);
  </code></pre>
  
  <p>For which I got:</p>
  
  <blockquote>
    <p>ping: icmp open socket: Operation not permitted</p>
  </blockquote>
  
  <p>I also tried to run an another program from an app (which shows an image on the Android screen - surfaceflinger sink). So, I included <code>android.permission.ACCESS_SURFACE_FLINGER</code> in the manifest file. However, it wasn't able to display on surfaceflinger sink.</p>
  
  <p>So, I have a feeling that these permissions are not passed on to these external programs. Is there a way to achieve this? I don't want to convert these C-based programs to Java.</p>