title: Accessing a USB camera using Android-Camera2 API
body: <p>I have a UVC camera that want to access and grab frames from in my Android Pie (Android 9) code.</p>
  
  <p>This is the code I'm using to enumerate the cameras connected to the Android phone:</p>
  
  <pre><code>    @Override
      public void onResume()
      {
          CameraManager manager =
                  (CameraManager)getSystemService(CAMERA_SERVICE);
          try {
              for (String cameraId : manager.getCameraIdList()) {
                  CameraCharacteristics chars
                          = manager.getCameraCharacteristics(cameraId);
                  // Do something with the characteristics
                  int deviceLevel = chars.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
                  Log.d(TAG, " **** device ["+cameraId+"] level:"+deviceLevel);
              }
          } catch(CameraAccessException e){
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>I was hopping on Android 9/Pie (Pixel 3) this shows the connected USB camera. But only two devices get listed, the front and back cameras og the phone.</p>
  
  <p>This is the list of features and permissions in my manifest file (AndroidManifest.xml):</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
  &lt;uses-feature android:name="android.hardware.usb.host" /&gt;
  </code></pre>
  
  <p>I cannot find any sample code on the internet how to achieve this, i.e. access the USB camera using on Android 9 and later.</p>
  
  <p>What am I missing to get my code enumerate the USB camera? I have seen some 3rd party UVC libraries for Android, but I don't to use them and want to use native Android code.</p>