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
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: prevent a screen lock

It seems Window class is only forward-declared in Application's header. Try including it directly:

 

#include <bb/cascades/Window>

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
javayoung
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900

Re: prevent a screen lock

By adding the include of window, it works. Thank you.




p(^_^)q
Good good study, day day up
Please use plain text.
Contributor
paul_shah
Posts: 17
Registered: ‎02-01-2013
My Device: Bold 9900

Re: prevent a screen lock

That line works!! Thank you :smileyhappy: 

Please use plain text.
New Contributor
raydelto
Posts: 3
Registered: ‎04-04-2013
My Device: Z10

Re: prevent a screen lock

Remember to include the libscreen, system and bps in your build. It worked for me.

 

Add the following to your .pro file:

 

LIBS += -lbbsystem -lscreen -lbps

 

With the following code it has worked for me:

 

Window *winId = Application::instance()->mainWindow();
if (winId != NULL) {
int idleMode = SCREEN_IDLE_MODE_KEEP_AWAKE;
screen_set_window_property_iv(screen_window_t(winId), SCREEN_PROPERTY_IDLE_MODE, &idleMode);
}

 

 

Please use plain text.