Flashlight
This plugin allows you to switch the flashlight / torch of the device on and off.
Requires Cordova plugin: cordova-plugin-flashlight
. For more info, please see the Flashlight plugin docs.
Repo: https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-flashlight $ npm install --save @ionic-native/flashlight@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
- Windows Phone 8
Usage
import { Flashlight } from '@ionic-native/flashlight';
constructor(private flashlight: Flashlight) { }
...
this.flashlight.switchOn();
Instance Members
available()
Checks if the flashlight is available
Returns: Promise<boolean>
Returns a promise that resolves with a boolean stating if the flashlight is available.
switchOn()
Switches the flashlight on
Returns: Promise<boolean>
switchOff()
Switches the flashlight off
Returns: Promise<boolean>
toggle()
Toggles the flashlight
Returns: Promise<any>
isSwitchedOn()
Checks if the flashlight is turned on.
Returns: boolean