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

Web and WebWorks Development

Reply
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Display Keep-Alive in WebWorks / PlayBook

My app needs the display to NOT go idle in certain cases. I've been able to do this in Cascades and on iOS but I still can't do it in a WebWorks app for PlayBook. I know there was a plugin for this that was deemed broken. Did this ever get fixed? My app would be a LOT better with the display not idling out after a certain amount of time.

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
jamesgibbons
Posts: 26
Registered: ‎06-01-2010
My Device: Dev Alpha, PlayBook

Re: Display Keep-Alive in WebWorks / PlayBook

The following code should work for the Playbook to ensure that the screen stays awake at all times: 

 

<div style="z-index:-1;  width:0px; height: 0px; overflow:hidden">
      <object data="/assets/videos/awake2.swf" type="application/x-shockwave-flash">
        <param name="movie" value="/assets/videos/keepAwake.swf">
        <param name="play" value="true">
        <param name="loop" value="true">
      </object>
  </div>

This is definitely a hack, but it was the only way I was able to get it to work. Looping an HTML5 audio or video file does keep the device awake too, but unfortunately tends to interfere with background audio/video and forces the title of the playing track to be displayed in the status bar.

 

Let me know if there are any issues.

 

Cheers,

 

James

___________________________________________________________
My latest Blackberry 10 app Audiobooks! :smileyhappy:

My latest PlayBook app Photojam!

Find me on Twitter: GoGibbons
Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Display Keep-Alive in WebWorks / PlayBook

Wow this is a great idea, thanks!

You could actually make it possible to turn it on and off by creating a function that dynamically inserts / removes the html you posted. I'm going to try that!

 

Cheers,

 

Marco

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
The_Anomaly
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: Display Keep-Alive in WebWorks / PlayBook

Similar thread;

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Making-the-Screen-stay-on/td-p/1...

 

It seems to be coming to webworks though.

If it helped you, click like. :smileyhappy:
Please use plain text.
Developer
jamesgibbons
Posts: 26
Registered: ‎06-01-2010
My Device: Dev Alpha, PlayBook

Re: Display Keep-Alive in WebWorks / PlayBook

If you want to let users control whether the application goes to sleep or not, you can just swap the display of the videoLoop div (posted above) between 'block' and 'none'.

 

// use system sleep defaults
document.getElementById('videoLoop').style.display = 'none';

// keep screen awake
document.getElementById('videoLoop').style.display = 'block';

Cheers,

 

James

___________________________________________________________
My latest Blackberry 10 app Audiobooks! :smileyhappy:

My latest PlayBook app Photojam!

Find me on Twitter: GoGibbons
Please use plain text.