@capgo/capacitor-flash
Overview
Section titled “Overview”@capgo/capacitor-flash exposes flashlight control for QR scanners, safety tools, and camera companion flows. Check isAvailable(), turn the torch on with optional intensity, and read isSwitchedOn() before updating UI state.
iOS uses AVFoundation. Android uses Camera2 with intensity on supported API levels. Web uses the camera torch API where mobile browsers allow it.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | AVFoundation torch |
| Android | Yes | Camera2, intensity on Android 13+ where supported |
| Web | Partial | Mobile Chrome torch when permitted |
Core Capabilities
Section titled “Core Capabilities”isAvailable- Checks if flashlight is available on the device.switchOn- Turns the flashlight on.switchOff- Turns the flashlight off.isSwitchedOn- Checks if the flashlight is currently turned on or off.
Public API
Section titled “Public API”| Method | Description |
|---|---|
isAvailable | Checks if flashlight is available on the device. |
switchOn | Turns the flashlight on. |
switchOff | Turns the flashlight off. |
isSwitchedOn | Checks if the flashlight is currently turned on or off. |
toggle | Toggle the flashlight on or off. |
getPluginVersion | Get the native Capacitor plugin version. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-flash.
Keep going from @capgo/capacitor-flash
Section titled “Keep going from @capgo/capacitor-flash”If you are using @capgo/capacitor-flash to plan dashboard and API operations, connect it with Using @capgo/capacitor-flash for the native capability in Using @capgo/capacitor-flash, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.