Thursday, 6 March 2014

Using FlashLight plugin in Phonegap Applications

Flashlight works with PhoneGap applications,Compatible with PhoneGap 3.0.0 and up. You can implement the plugin with these simple steps.

1. Installation:
  a. Download phonegap flashlight plugin here.
  b. place FlashLight.js inside your application's www/js/plugin folder.
  c. Add the following xml to your config.xml to always use the latest version of  this plugin:

  <gap:plugin name="nl.x-services.plugins.flashlight" />

  or to use this exact version:

  <gap:plugin name="nl.x-services.plugins.slashlight" version="1.0" />

 d. Reference the JavaScript code in your index.html:

 <script src="js/plugins/Flashlight.js"></script>

Note: keep it mind that FlashLight plugin must be referenced after phonegap in your index.html file.

2. Usage:
use these scripts to handle FlashLight events.

 window.plugins.flashlight.switchOn(); // to on flashlight.
 window.plugins.flashlight.switchOff(); // to off flashlight.

As an alternative to switchOn and switchOff, you can use the toggle function

window.plugins.flashlight.toggle();




No comments:

Post a Comment