title: Android App continous receiving data via USB
body: <p>I'm developing an Android App which i want to communicate with a device connected via USB. This device is delivering data all the time. These data are visible with a programm on the android linux shell.</p>
  
  <p>My goal is to see those data in my App and after that deliver them via a Service to other Apps.</p>
  
  <p>So my question is: Can i "open" a connection from my Android App to the USB-Port so im continuesly receiveing the data in my app, which are sent by the usb-device? And if yes, how would the code look like?</p>
  
  <p>*Edit</p>
  
  <p>Thank you for your answers, the app itself doesn't run on the commandline any more. So its no executable anymore but a shared library getting load by my android app.
  It did before, but i want to be able to initiate the connection using NDK methods in my App to be able to see the data in my App itself. So I've tried to see if a connection is allready open.</p>
  
  <p>I've added some functions to my code, so i can see if the usb-connection is open and i have the permission to that usb device.</p>
  
  <pre><code>UsbManager.hasPermission(device)
  </code></pre>
  
  <p>returns true, because I'm using an itent filter. </p>
  
  <pre><code>UsbManager.openDevice(device)
  </code></pre>
  
  <p>returns an UsbDeviceConnection, so i seem to have the access to use that device.</p>
  
  <p>What im not capable of so far is receiving either iniciating the bus connection to by usb-device and of course either getting data input of that device.</p>
  
  <p>Since my native code allready has a while(true)-method which is only using callbacks to send data to my app when actually data getting sent trough my usb-device i want to keep the work done in my c-code.</p>
  
  <p>The only job my app should do is open the bus-connection once and after that be ready for callback from the c-code.</p>
  
  <p>Is that possible?</p>