Accessing a USB camera using Android-Camera2 API

I think I found the answer to my own question. I purchased a Samsung Galaxy S10e and the same exact code without any modification returns the USB camera as the first one in the list. That is this line Log.d(TAG, " **** device ["+cameraId+"] level:"+deviceLevel); prints 3 times, one for the USB camera and two of the internal cameras.

My best guess is that most phones designed and manufactured after October 2018 when Android 9 was released do have this feature enabled. The phone that were released about that time or before and then later received an update to Android 9 (Pie) are unlikely to have this feature.


You can call PackageManager.hasSystemFeature with the constant FEATURE_CAMERA_EXTERNAL to check if your device supports external cameras. Pixel 3 does not support this feature.

Indeed, there are multiple libraries and applications, which offers USB camera support. But they do not use android API and implement everything themselves. The most common approach seems to use Video for linux kernel module (if the kernel was compiled with this module). It also requires permissions to access /dev/video devices, which is not usually the case on non-rooted devices. But the implementation is fairly simple. E.g. android-webcam uses this approach.

Another approach is to use USB host api and implement all the protocols yourself. This does not require root access, but implementation is far more complex. You can check this library which goes this way.