Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 28
Registered: ‎02-24-2012
My Device: BlackBerry Z10 Limited Edition
My Carrier: Free

Reading Sensors before app launches.

[ Edited ]

I'm trying to check the ambient light sensor before app starts to set the appropriate theme of the app.

So basically I need to read the sensor at the very beggining in main() function (it's important I can set the theme only there), but the sensor reader always returns undefined light.


After hours of debugging I got to the conclusion that the sensors are inittialized only after the app starts and shows the main view (why BlackBerry??? Why?), which doesn't make any sens to me.


So is there a way to read the sensors right in the main() function before the app starts?


Thank you.

Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Reading Sensors before app launches.

is it possible to try running it in a separate thread and see if it recognizes it then?