Programmatically adjusting flashlight brightness

Hi,

I’m trying to write a flashlight app for Android. The standard API to turn on the flashlight is:

val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
        try {
            val cameraId = cameraManager.cameraIdList[0]
            cameraManager.setTorchMode(cameraId, true)
        } catch (e: CameraAccessException) {
        }

However on my Galaxy S10 just turning on like this sets the brightness at 3 of 5. I’m wondering if the flashlight brightness is accessible to a developer, perhaps by modifying a system file like what used to be possible with some HCL phones.

Hi,
There is no official API or SDK for this, unfortunately.

You might find this thread helpful. Please check below,

Thank you

I already read all SO threads that exist on the subject I think, but thanks.