nhoxbypass
nhoxbypass

Reputation: 10152

Check front flash available using camera2 API

I'm testing my camera app on Samsung J7 Pro which have front flash (real hardware LED flash). When I'm checking front flash available with the deprecated Camera API using:

List<String> supportFlashModes = defaultParameters.getSupportedFlashModes();
boolean isSupportedFlashMode = (supportFlashModes != null && supportFlashModes.contains(Camera.Parameters.FLASH_MODE_ON));

it works properly, the supported flash modes return 4 values (on, off, auto_flash, always_flash) for front camera.

But when I'm checking with the new Camera2 API using:

Boolean b = characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
boolean isSupportedFlashMode = b != null ? b : false;

isSupportedFlashMode always return false for front camera. And if I check the supported flash modes using:

characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES);

it's also return only 2 values (ae_on, ae_off).

Does anyone know how to solve this? Note that I've just want to check the availability of device's front flash Thank you.

Update

These methods worked fine on my Q-Mobile device (which also have a real LED front flash), but still not working on Samsung J7 Pro. I don't know why?

Upvotes: 6

Views: 1101

Answers (1)

Nha T. Tran
Nha T. Tran

Reputation: 361

It seen to be a device related issues. My company app which using camera2 API also faced the same problem.

I've already try to test it with a simple sample and OpenCamera but none of them worked. Then I decided to hold this bug till now because the number of devices that have front flash is small and most of them worked fine.

Upvotes: 4

Related Questions