title: How to get list of usb devices connected from a service
body: <p>I am writing a <strong>service</strong> which would send some proprietary commands to a specific USB device connected to Android based box. 
  Earlier I had implemented an app (with Activity) so it was pretty straightforward:</p>
  
  <pre><code>UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
  </code></pre>
  
  <p>My main class:</p>
  
  <pre><code>public class MyService extends IntentService {
   ..
   mUsbManager = (UsbManager) getApplicationContext().getSystemService(USB_SERVICE);
  
  }
  </code></pre>
  
  <p>And I end up with : </p>
  
  <blockquote>
    <p>java.lang.NullPointerException: Attempt to invoke
    virtual method 'android.content.Context
    android.content.Context.getApplicationContext()' on a null object
    reference</p>
  </blockquote>
  
  <p>Now without an activity I am not finding any ways to get an instance of UsbManager.</p>
  
  <p>Is there a way to do this in a service? </p>