[r174]Ambient light doesn't trigger on Windows Phone 8.1

Bugs will be moved here once resolved.

Post » Thu Jul 10, 2014 12:17 pm

Problem Description
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.

Observed Result
The variable is setted on start, but not continously

Expected Result
The "readingchanged" JS events fire the construct 2 event.

Affected Browsers
  • 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
Code: Select all
if (this.runtime.isWinJS && !this.runtime.isWindows8Capable)
      {
         var lightSensor = Windows["Devices"]["Sensors"]["LightSensor"]["getDefault"]();
         if (lightSensor)
         {
            var minInterval = lightSensor["minimumReportInterval"];
            lightSensor["reportInterval"] = (minInterval > 16 ? minInterval : 16);
            lightSensor.addEventListener("readingchanged", function (e)
            {
               ambientlux = e["reading"]["illuminanceInLux"];
               self.runtime.trigger(cr.plugins_.UserMedia.prototype.cnds.OnDeviceLight, self);
            });
         }
      }


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...
Luca ConTato [RisingPixel]
Image
B
22
S
8
G
2
Posts: 112
Reputation: 2,899

Post » Thu Jul 17, 2014 9:35 pm

I open this example and i dont know what is this ambient light please explain me ?
B
109
S
26
G
46
Posts: 1,885
Reputation: 35,166

Post » Wed Jul 23, 2014 9:49 am

Ambient light check light sensor of your camera/phone... it's a feature of User Media plugin https://www.scirra.com/manual/144/user-media
Luca ConTato [RisingPixel]
Image
B
22
S
8
G
2
Posts: 112
Reputation: 2,899

Post » Thu Jul 24, 2014 4:20 pm

It works on a Nokia Lumia 520, but as you say the event stops firing after about 10 seconds. As you also noticed it is because Windows Phone itself is not firing the "readingchanged" event any more. This is to do with Windows Phone, not Construct 2 - the fact it works for at least a few seconds shows our code is working. You may want to report this to Microsoft. Closing as not a C2 bug.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,684


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest