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
New Developer
Posts: 10
Registered: ‎04-26-2011
My Device: Bold 9790 + Playbook
My Carrier: Telus

Keep timer running in the background

I have a webworks application that uses a javascript timer, the problem is whenever the app is moved to the background or the device goes on stand-by, the timer stops.

 

Is there any way I can keep the timer going even if the device goes on standby?

Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Keep timer running in the background

Yes, using Javascript Extension, by implementing TimerTask inside it.
New Contributor
Posts: 4
Registered: ‎03-05-2011
My Device: Playbook
My Carrier: N/A

Re: Keep timer running in the background

[ Edited ]

Would custom javascript extentions work on the playbook? I haven't been able to find any documentation on this. I tried this solution but on my test device the js timer stops functioning intermitently when the device sleeps.

 

thanks,

Kwab
Highlighted
Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Keep timer running in the background

currently, javascript extentions doen't work on the playbook
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Keep timer running in the background

On the PlayBook it all depends on which mode you have your device setup for.  If you go to the General tab in your settings of the PlayBook you can configure "Application Behaviour".  You can select from "Default", "Showcase" and "Paused".  These settings will determine how your code will behave if your application is not in the foreground.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 4
Registered: ‎03-05-2011
My Device: Playbook
My Carrier: N/A

Re: Keep timer running in the background

Thanks agungeddy. You saved me hours of frustration.

 

Thanks tnell. I've had my device in "Showcase" for all of my testing. The behaviour is still inconsistent. I use several javascript setTimeout commands in "parallel". When the device sleeps (either by the user pushing the power button or "Standby Time-out") the behaviour ranges from the timers firing normally, pausing the app and resuming when woken up or worst of all, stopping all timers from firing essentially breaking my app.

 

Is there anything beyond adding "<inactivePowerMode>normal</inactivePowerMode> " to my blackberry-tablet.xml file that I can do? I assume the more advanced code examples here are for Air dev. I also have been including a config.xml into my package. Could having both a config.xml file and a blackberry-tablet.xml result in problems?

 

Thanks,

 

 

 

Kwab