Flashlight without FLASH_MODE_TORCH

Are there any options to turn on the flash for an undefined time when the phone does not support FLASH_MODE_TORCH in Camera.Parameters?

I know that this is possible because there are many applications running on my phone (Samsung Galaxy ACE), but I have not yet found the answer.

I just came:

Camera camera = Camera.open(); Camera.Parameters params = camera.getParameters(); params.setFlashMode(Camera.Parameters.FLASH_MODE_ON) //because FLASH_MODE_TORCH isnt supported camera.setParameters(params); camera.startPreview(); camera.autoFocus(new AutoFocusCallback(){ public void onAutoFocus(boolean success, Camera camera){ camera.autoFocus(this); } }); 

but this works with a slight delay, for example, 1/10 of a second.

is anyone

+4
source share
2 answers

Maybe the delay comes from autofocus . Have you tried to set focus to infinity?

 params.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); 
0
source

Set this code when Activity onCreat ()

 Camera camera = Camera.open(); Camera.Parameters params = camera.getParameters(); private void TurnOn(){ params.setFlashMode(Camera.Parameters.FLASH_MODE_ON) //because FLASH_MODE_TORCH isnt supported camera.setParameters(params); camera.startPreview(); } 
0
source

Source: https://habr.com/ru/post/1381385/


All Articles