Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android's camera API 2 in Kitkat

I'm trying to get the camera api2 working on Android 4.4.2 based on the following slides. http://www.slideshare.net/lbk003/an-devcon2013-camera3kaurfinal

However, the function getCameraIdList() returns an empty array with 'no devices; exception. I tried this on my google glass running Android 4.4.2 and also on an emulation of a nexus 5 running Android 4.4.2 with camera emulation enabled. Both gave the same error. Google glass camera api1 gives me access to the camera.

mCameraManager = (CameraManager) ctx.getSystemService("camera");
try {
String[] devices = mCameraManager.getCameraIdList();
if (devices == null || devices.length == 0) {
throw new ApiFailureException("no devices");
}

I also have the following two lines in the manifest file.

uses-permission android:name="android.permission.CAMERA"

uses-feature android:name="android.hardware.camera"

Has anyone been successful in using the hidden camera api2 in Android 4.4.2?

like image 829
Shakith Fernando Avatar asked Jan 10 '23 06:01

Shakith Fernando


1 Answers

Android 4.4.2 does not support the new camera2 API; it's only officially available on the L developer preview or later, and then only on real Nexus 5 hardware, not the emulator.

While an in-progress API is included in the source code of Android 4.4.2, it's not functional in general, and we don't recommend trying to use it, since it differs in various ways from the final API in the L preview.

like image 196
Eddy Talvala Avatar answered Jan 23 '23 16:01

Eddy Talvala