Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an External Usb Camera in Android

Could somebody give me an instruction, how to use an external camera in android app. My app need to use front/back and external cameras but there is no official external camera API I found some issues about this, but they don't have a full answer on how to implement this functionality and especially for android API 21+ versions. As I understand, Camera2 API supports external camera and I can use this API for displaying preview from usb-camera, but most of devices can not see connected external camera. How can I fix this and how can I get this camera id when receive cameras list

String[] cameraList = manager.getCameraIdList();

About "devices can not see usb-camera" I find a few answers : USB camera can not be connected to Android in general, because Android4.0 USB host function has some problems about isochronous transfer..

http://www.infinitegra.co.jp/en/solution/AndroidUsbCam.htm

and maby camera does not getting power from usb-port

https://stackoverflow.com/a/8986688/5219832

But it is written about the old camera API and I don't know, for example, how to get power from usb-port.

Please give me an answer for correctly working with external camera

like image 349
Jackky777 Avatar asked Jun 17 '16 09:06

Jackky777


People also ask

Can you connect a USB camera to an Android phone?

The Android platform supports the use of plug-and-play USB cameras (that is, webcams) using the standard Android Camera2 API and the camera HIDL interface.

Do USB cameras work with Android 10?

Android 10 devices do NOT support USB camera connection. Android 10 devices do NOT support UVC(USB Video Class) devices to be connected in the apps with targetSdkVersion API Level 28 and above.

How do I make my USB camera my default Android?

Go to Settings > Applications > Default Applications and delete all entries pertaining to your camera. That should reset the phone to ask you what camera to use for certain processes.


1 Answers

There's no Android-wide support for external USB cameras.

Some manufacturers have built in support for their own Android devices, but there's no guarantee that a particular Android device will support a webcam over the standard camera APIs.

If you need this feature, you'll need to find which devices support it, and how.

Some applications use the Android USB APIs to implement support for webcams, so that any device that supports USB host mode will work for those applications. But that won't make the cameras visible to other applications through the standard APIs.

like image 195
Eddy Talvala Avatar answered Oct 19 '22 12:10

Eddy Talvala