다음을 통해 공유


CameraManager.TurnOnTorchWithStrengthLevel(String, Int32) Method

Definition

Set the brightness level of the flashlight associated with the given cameraId in torch mode.

[Android.Runtime.Register("turnOnTorchWithStrengthLevel", "(Ljava/lang/String;I)V", "", ApiSince=33)]
public void TurnOnTorchWithStrengthLevel (string cameraId, int torchStrength);
[<Android.Runtime.Register("turnOnTorchWithStrengthLevel", "(Ljava/lang/String;I)V", "", ApiSince=33)>]
member this.TurnOnTorchWithStrengthLevel : string * int -> unit

Parameters

cameraId
String

The unique identifier of the camera device that the flash unit belongs to.

torchStrength
Int32

The desired brightness level to be set for the flash unit in the range 1 to android.hardware.camera2.CameraCharacteristics#FLASH_INFO_STRENGTH_MAXIMUM_LEVEL.

Attributes

Remarks

Set the brightness level of the flashlight associated with the given cameraId in torch mode. If the torch is OFF and torchStrength is >= 1, torch will turn ON with the strength level specified in torchStrength.

Use android.hardware.camera2.CameraCharacteristics#FLASH_INFO_STRENGTH_MAXIMUM_LEVEL to check whether the camera device supports flash unit strength control or not. If this value is greater than 1, applications can call this API to control the flashlight brightness level.

If #turnOnTorchWithStrengthLevel is called to change the brightness level of the flash unit CameraManager.TorchCallback#onTorchStrengthLevelChanged will be invoked. If the new desired strength level is same as previously set level, then this callback will not be invoked. If the torch is OFF and #turnOnTorchWithStrengthLevel is called with level >= 1, the torch will be turned ON with that brightness level. In this case CameraManager.TorchCallback#onTorchModeChanged will also be invoked.

When the torch is turned OFF via #setTorchMode, the flashlight brightness level will reset to default value android.hardware.camera2.CameraCharacteristics#FLASH_INFO_STRENGTH_DEFAULT_LEVEL In this case the CameraManager.TorchCallback#onTorchStrengthLevelChanged will not be invoked.

If torch is enabled via #setTorchMode after calling #turnOnTorchWithStrengthLevel with level N then the flash unit will have the brightness level N. Since multiple applications are free to call #setTorchMode, when the latest application that turned ON the torch mode exits, the torch mode will be turned OFF and in this case the brightness level will reset to default level.

Java documentation for android.hardware.camera2.CameraManager.turnOnTorchWithStrengthLevel(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to