Flashlight-PhoneGap-Plugin icon indicating copy to clipboard operation
Flashlight-PhoneGap-Plugin copied to clipboard

window.plugins.flashlight.isSwitchedOn(); return false if flashlight was turn on by the android button

Open Clankey opened this issue 7 years ago • 3 comments

The plugin isn't able to identify correctly if the flashlight in on or off. If I turn on the flashlight by the android button or widget, the function will always return false. It only returns true if I use window.plugins.flashlight.switchOn(); to turn on

Clankey avatar Sep 10 '17 21:09 Clankey

I have a similar problem on iOS, if the light was turned on by another app this .isSwitchedOn() returns false. This is because the .isSwitchedOn() method returns the internal status of the light, assuming it will always be turned on/off using this plugin.

The solution is to query the light status for every call to .isSwitchedOn().

john-doherty avatar Oct 12 '17 13:10 john-doherty

I have similar issue, isSwitchedOn() return false always until I execute toggle() function. If I never run any other function than isSwitchedOn() then it always returns false. Any update @Clankey @john-doherty @EddyVerbruggen @IagoSRL @cooper1388

akashbiz avatar Nov 06 '17 10:11 akashbiz

@akashbiz Please don't ping people. Instead, take a look at the code and try to come up with a solution.

EddyVerbruggen avatar Nov 06 '17 10:11 EddyVerbruggen