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

1.2.27 • Public • Published

capacitor-flash

Capgo - Instant updates for capacitor

Switch the Flashlight / Torch of your device.

Install

npm install @capgo/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; }>


Install

npm i @capgo/capacitor-flash

DownloadsWeekly Downloads

388

Version

1.2.27

License

MIT

Unpacked Size

28 kB

Total Files

26

Last publish

Collaborators

  • riderx