I can not use plug-flashlight

  • 1
  • Question
  • Updated 5 years ago
  • Answered
I added a file confing.xml the line:

My HTML is:
<!DOCTYPE html SYSTEM>

But the flashlight will not turn on at all
Photo of is

is

  • 11 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of ismael jimoh

ismael jimoh

  • 4116 Posts
  • 192 Reply Likes
Hi Is,

Please can't view the HTML file included, also do add your app id.

Add the following to your config.xml for flashlight plugin(note it only works on versions 3.0 and later)

<pre>&lt;gap:plugin name="nl.x-services.plugins.flashlight" /&gt;</pre>
You can find the documentation on setting this up in the plugin page, do follow it to letter.

Thanks.

Ismael.
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
I added a file confing.xml the line:


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


My HTML is:



<!DOCTYPE html>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="phoneGap.js"></script>
<script src="flashlight.js"></script>
<script src="js/plugins/Flashlight.js"></script>

</head>
<body>

<div class="app">
<input type="button" value="flashlight" onclick="fl" />
</div>

<script type="text/javascript">
function fl() {
window.plugins.flashlight.available(function (isAvailable) {
if (isAvailable) {

// switch on
window.plugins.flashlight.switchOn(); // success/error callbacks may be passed

// switch off after 3 seconds
setTimeout(function () {
window.plugins.flashlight.switchOff(); // success/error callbacks may be passed
}, 3000);

} else {
alert("Flashlight not available on this device");
}
});
}

app.initialize();
</script>
</body>
</html>


But the flashlight will not turn on at all
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
Hi,

The isAvailable function always returns false on Android in the 1.1 version of the plugin. Sorry for the inconvenience.

You can use the 1.0 version, or remove the isAvailable check. There is a pending update of the plugin, but it has not yet been approved.

Hth,
Eddy
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
The 1.3 version has been approved, so the isAvailable function works correctly now: https://build.phonegap.com/plugins/443
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
I changed the file web.confing


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


But it does not work for me yet.
And so it does not work



window.plugins.flashlight.toggle();
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
There must be a usage issue then. Can you share your entire codebase with me? Mail it to eddyverbruggen[at]gmail.com, or use wetransfer. Even better: is this project on github?
Photo of Zahir

Zahir

  • 3500 Posts
  • 40 Reply Likes
Hi all,

Would you mind updating us on your current progress?
Thanks.
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
I was not able to use this plugin
All versions
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
Hi,

Your code is fine and works correctly on my Samsung Galaxy S3 with Android 4.3 and iPhone 5 with iOS7. So maybe it's your device that's the problem. Are you on Android 2 perhaps?
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
my phone Android 4.3
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
Can you please give me the full spec? Make, model, etc.
Photo of is

is

  • 11 Posts
  • 0 Reply Likes
galaxy S4 GT-19500
android 4.2.2
Photo of Hüseyin Çelik

Hüseyin Çelik

  • 58 Posts
  • 0 Reply Likes
i down load this code

https://github.com/Icenium/sample-fla...

to my web site http://www.awaspi.com/a/index.html
it is not work with desktop browser..it is ok
but when i opened http://www.awaspi.com/a/index.html this url with iphone
there is a button "Turn ON Flashlight"
i click that it does not do any thing

i want to access device flashlight and handle it and open it automatically
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
Hi, did you actually wrap the code in an app, or did you use the iPhone Safari browser to access the page?
Photo of Hüseyin Çelik

Hüseyin Çelik

  • 58 Posts
  • 0 Reply Likes
i am using iphone safari
here is code i deployment: http://www.awaspi.com/a/index.html

i included flashlight plugin js file

view-source:http://www.awaspi.com/a/index.html

are there any completed flashlight sample code that i uploaded my website?
i want to look it than i will wrap the code in an app
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
You need to create and deploy an app to your phone in order to be able to access device features (like the flashlight).

If you want an easy way to create and test the Flashlight plugin on a real device then I can recommend using 'Try plugin..' button at the top of this page: http://plugins.telerik.com/plugin/fla...

As an alternative you can pull this repo into your PhoneGap Build account: https://github.com/EddyVerbruggen/X-S...
Photo of Hüseyin Çelik

Hüseyin Çelik

  • 58 Posts
  • 0 Reply Likes
thank you @Eddy Verbruggen

i Scan the QR code with "try plugin......"
does it support iphone 4(ios 8)
now it is app in my iphone 4
but i click Turn ON Flashlight it does not do any thing
should it flashlight like attached file?are there any app that i will see
what is do?
i want to do app like this: https://www.youtube.com/watch?v=W_Lr3...

Photo of Hüseyin Çelik

Hüseyin Çelik

  • 58 Posts
  • 0 Reply Likes
i deploy it ( https://platform.telerik.com/#appbuil... ) to my iphone 4(IOS 7.1.2)

via https://platform.telerik.com/#appbuil...

this url
i build it and then
i deploy it with using QR code inside APP builder and then i open app builder app in attached file it does not open or close flashlight as this

https://d2r1vs3d9006ap.cloudfront.net...