The ambient light sensor (lux) on Windows Phone 8.1 doesn't work correctly
Attach a Capx
You can try with the default light-sensor example, anyway here a copy of the capx https://www.dropbox.com/s/p30met8ab27lj ... Light.capx
Description of Capx
The Ambient light variable doesn't update. So i can't get the current state of ambient-light or lux value
Steps to Reproduce Bug
- Export to windows phone WinJS universal app (8.1)
- Run application on a Windows Phone 8.1 with lux capability (es: lumia 925)
- Look the value : it doesn't change.
The variable is setted on start, but not continously
The "readingchanged" JS events fire the construct 2 event.
- Internet Explorer (Windows Phone 8.1): (YES)
Operating System and Service Pack
Windows Phone 8.1 (8.0 doesn't support lux)
Construct 2 Version ID
Construct 2 r174 personal edition
I Debug a little in the visual studio project and i checked the fragment "responsible" of light relevation
if (this.runtime.isWinJS && !this.runtime.isWindows8Capable)
var lightSensor = Windows["Devices"]["Sensors"]["LightSensor"]["getDefault"]();
var minInterval = lightSensor["minimumReportInterval"];
lightSensor["reportInterval"] = (minInterval > 16 ? minInterval : 16);
lightSensor.addEventListener("readingchanged", function (e)
ambientlux = e["reading"]["illuminanceInLux"];
If i make a breakpoint into the event listener body (self.runtime.trigger(cr.plugins_.UserMedia.prototype.cnds.OnDeviceLight, self);) I verified that the event is raised only a few times...