Flashlight

Improve this doc

$ ionic plugin add cordova-plugin-flashlight

Repo: https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git

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.

Usage

import {Flashlight} from 'ionic-native';

Static Methods

available()

Checks if the flash light is available

Returns: Promise<boolean> Returns a promise that resolves with a boolean stating if the flash light is available.

switchOn()

Switches the flashlight on

Returns: Promise<boolean>

switchOff()

Switches the flash light off

Returns: Promise<boolean>

toggle()

Toggles the flashlight

Returns: Promise<any>

isSwitchedOn()

Checks if the flash light is turned on. Returns a boolean

API

Native

General