EddyVerbruggen / Flashlight-PhoneGap-Plugin

:flashlight: Cordova plugin for using the torch / flashlight of your device
MIT License
61 stars 70 forks source link

[newbie] Help to use plugin #15

Closed KRSoftware closed 10 years ago

KRSoftware commented 10 years ago

Hello, I am a french guy and I began to develop in cordova / phonegap.

I need help to use this plugin, i don't understand how to use it to an HTML and JS page?

can you help me with an example, with a button which start the flash and stop the flash?

thanks.

EddyVerbruggen commented 10 years ago

Hi, how do you build your app? Local with the CLI, PhoneGap Build, Telerik AppBuilder..

KRSoftware commented 10 years ago

Hello, thanks you for your answer!

Basically, I wanted to use visual studio and its extension but I could not reach a flash. Then I found your plugin and put myself to use the CLI.

I apologize in advance for my poor English

KRSoftware commented 10 years ago

Do you think that possible?

HTML [code]

[/code]

javascript [code] function teste() { window.setInterval("flashOn()",test); }

function flashOn(){ window.plugins.flashlight.switchOn(); setTimeout(function() { window.plugins.flashlight.switchOff(); }, 1000); } [/code]

EddyVerbruggen commented 10 years ago

Yes, but you can also use the toggle function for that purpose, see the readme for details.

KRSoftware commented 10 years ago

Thanks for your help!

KRSoftware commented 10 years ago

And I have a second question, i want to test the application, but i supposed it's not possible with Ripple? i think, i have to compile the application to see the flash?

EddyVerbruggen commented 10 years ago

Exactly. You need to run it on a device.

Good luck!

KRSoftware commented 10 years ago

Thank you!