Welcome!

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

Reply
Contributor
umakamat
Posts: 14
Registered: ‎01-21-2013
My Device: BB10 alpha device

setScreenIdleMode() function does not set screen idle mode back to Normal.

Hi

 

In my application i needto keep the screen awake on a perticular page. I could achive this using the Window's API setScreenIdleMode(ScreenIdleMode::KeepAwake).

This works fine.

 

When I navigate to some other page, I need to setScreenIdleMode back to ScreenIdleMode::Normal.

This is not working.

 

Please let me know if I am missing on anything..

 

Thanks,

Uma

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: setScreenIdleMode() function does not set screen idle mode back to Normal.

That setting is global for your app, so you have to control it yourself. If you switch away from one page and go to another, you must make the change in that property yourself.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
umakamat
Posts: 14
Registered: ‎01-21-2013
My Device: BB10 alpha device

Re: setScreenIdleMode() function does not set screen idle mode back to Normal.

Yes. I have called the same API as below to set it back to Normal mode.. But it does not seem to work.

 

Application::instance()->mainWindow()->setScreenIdleMode(ScreenIdleMode::Normal);

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: setScreenIdleMode() function does not set screen idle mode back to Normal.

It's working fine here for me, so look into your own logic for bugs. Have you tried adding some log output before and after that line, so you can both verify that the change occurred (read back the value) and that the code is executing at all?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
umakamat
Posts: 14
Registered: ‎01-21-2013
My Device: BB10 alpha device

Re: setScreenIdleMode() function does not set screen idle mode back to Normal.

Thanks a lot for the reply.

 

Actually I have a ForeignWindow in this screen and i had set the following proprty of this foreignwindow

 

int idle_mode = SCREEN_IDLE_MODE_KEEP_AWAKE;
screen_set_window_property_iv(win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);

 

This was the reson setScreenIdleMode(Normal) was taking effect. I removed above two lines and its working fine now.

 

Thanks,

Uma

Please use plain text.