This package has been deprecated

Author message:

migrate to @capgo/capacitor-flash

capacitor-flash
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

capacitor-flash

Switch the Flashlight / Torch of your device.

Install

npm install capacitor-flash
npx cap sync

iOS

Works out of the box

Android

  1. Declare permissions in your app's AndroidManifest.xml file
<!-- Permissions: Allows access to flashlight -->
<uses-permission android:name="android.permission.CAMERA" android:maxSdkVersion="23" />
<uses-permission android:name="android.permission.FLASHLIGHT" />

<!-- Actual Hardware Features Used-->
<uses-feature android:name="android.hardware.camera.flash" android:required="true" />

API

isAvailable()

isAvailable() => Promise<{ value: boolean; }>

Checks if flashlight is available

Returns: Promise<{ value: boolean; }>


switchOn(...)

switchOn(options: { intensity?: number; }) => Promise<void>

Turns the flashlight on

Param Type
options { intensity?: number; }

switchOff()

switchOff() => Promise<void>

Turns the flashlight off


isSwitchedOn()

isSwitchedOn() => Promise<{ value: boolean; }>

Checks if the flashlight is turned on or off

Returns: Promise<{ value: boolean; }>


toggle()

toggle() => Promise<{ value: boolean; }>

Toggle the flashlight

Returns: Promise<{ value: boolean; }>


Package Sidebar

Install

npm i capacitor-flash

Weekly Downloads

1

Version

1.1.3

License

MIT

Unpacked Size

27.6 kB

Total Files

26

Last publish

Collaborators

  • riderx