Skip to main content

setFlashlight

Note
Please contact Zalopay Team to be granted permission to use this functionality.

Supported Version

zpa
Started support in Zalopay App from version 8.26.0

Description

Turn on/off phone flash

Parameters

ParamData typeRequiredDescription
onbooleanYestrue: turn on flashlight, false: turn off flashlight

Return Value

N/A

Error Code

Error CodeDescription
011101Flashlight not supported
011102Cannot turn on/off the flashlight

Sample Code and Sample Return Data

Sample Request:

window.zlpSdk.Device
.setFlashlight({ on: true })
.then((response) => console.log(response))
.catch((error) => console.error(error.errorCode));

Sample Response:

{ data: {}, status: "success" }