EddyVerbruggen / Flashlight-PhoneGap-Plugin

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

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

Open Clankey opened 7 years ago

Clankey commented 7 years ago

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

john-doherty commented 7 years ago

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().

akashbiz commented 7 years ago

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

EddyVerbruggen commented 7 years ago

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