0

I am working on a kind of torch application in android Studio environment. I want to use a pulse waves modulated(PWM) to make the flash light be adapted to the ambient light. I made lot of research about that, but i didn't find any tutorial about how to manage the camera's flash alone in android studio. Is there any solution?

4

1 回答 1

1

An Android device's camera flash can be controlled with the setTorchMode() method starting with Android M.

Prior to that, you have to open a camera device with either the deprecated camera API, or the new camera2 API, and change the flash state to TORCH.

However, even with camera2, you won't be able to modulate the flash at a high rate - I'd be surprised if you could reach 30Hz, and certainly not faster.

So without building your own Android ROM, and modifying the flash LED driver code, you're unlikely to be able to do this.

于 2016-04-13T21:48:32.430 回答