Socket
Socket
Sign inDemoInstall

capacitor-flash

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    capacitor-flash

Switch the Flashlight / Torch of your device.


Version published
Weekly downloads
3
Maintainers
1
Install size
26.9 kB
Created
Weekly downloads
 

Readme

Source

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()
  • switchOn(...)
  • switchOff()
  • isSwitchedOn()
  • toggle()

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

ParamType
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; }>


Keywords

FAQs

Last updated on 15 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc