Ionic Framework Flashlight
I am trying to create an app using the Ionic Framework and Plugin store ngCordova
I have Following Instruction to get the Flashlight working by
Installing ngCordova Plugin with bower
Including ngCordova.js in a script tag before ngCordova.js
Installing the necessary plugin with cordova.More Ionic Framework
Flashlight Cordova Plugin:
cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git
Example Code:
module.controller('MyCtrl', function($scope, $cordovaFlashlight) {
$cordovaFlashlight.available().then(function(availability) {
var avail = availability; // is available
}, function () {
// unavailable
});
$cordovaFlashlight.switchOn()
.then(
function (success) { /* success */ },
function (error) { /* error */ });
$cordovaFlashlight.switchOff()
.then(
function (success) { /* success */ },
function (error) { /* error */ });
$cordovaFlashlight.toggle()
.then(function (success) { /* success */ },
function (error) { /* error */ });
});
$cordovaFlashlight.available().then(function(availability) {
var avail = availability; // is available
}, function () {
// unavailable
});
$cordovaFlashlight.switchOn()
.then(
function (success) { /* success */ },
function (error) { /* error */ });
$cordovaFlashlight.switchOff()
.then(
function (success) { /* success */ },
function (error) { /* error */ });
$cordovaFlashlight.toggle()
.then(function (success) { /* success */ },
function (error) { /* error */ });
});