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

6.0.0 • 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() => any

Checks if flashlight is available

Returns: any


switchOn(...)

switchOn(options: { intensity?: number; }) => any

Turns the flashlight on

Param Type
options { intensity?: number; }

Returns: any


switchOff()

switchOff() => any

Turns the flashlight off

Returns: any


isSwitchedOn()

isSwitchedOn() => any

Checks if the flashlight is turned on or off

Returns: any


toggle()

toggle() => any

Toggle the flashlight

Returns: any


Package Sidebar

Install

npm i @capgo/capacitor-flash

Weekly Downloads

1,614

Version

6.0.0

License

MIT

Unpacked Size

27.7 kB

Total Files

26

Last publish

Collaborators

  • riderx