Search code examples
androidkotlinandroid-cameraandroid-jetpackandroid-camerax

Select torch to use with Android CameraX


I have developed an application that uses the Camera using the CameraX library. I can control both the front and back cameras and turn their torches on and off. The problem is that one phone, a Huawei P20, has 2 torches on the back camera. Using the native camera app on the phone, you can select the cool or warm light torch by swiping. Electrically, it can be seen that there are 2 separate LEDs inside. Does the CameraX library have the ability to select which LED I'd like to use at a given time?


Solution

  • No, unfortunatelly there's no way to control the torch beyond on/off using CameraX or Camera2. The different torch modes are manufacturer specific and are not usually accessible to developers at all.