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
aburt
Posts: 8
Registered: ‎11-22-2009
My Device: Not Specified

setTimeout and setInterval not working after backlight times out

Hmm, here's a problem, perhaps a bug? Javascript setTimeout() and setInterval() aren't working after the backlight times out.

 

DETAILS:  I have a web page with a clock in the title bar.  The time is updated with a javascript setInterval.  As long as the page remains visable after loading it works great; the time updates.  But once the backlight timeout occurs, after 35 seconds, the interval timer quits firing.

 

That is, if the tile clock said "1:02:03" as the screen goes dim, if I wake it up after five minutes, it will have frozen at "1:02:38".

 

(Probably not relevant but who knows: The duration of 35 seconds seems pretty repeatable.  Also, if I wake up the screen before 35 seconds, it keeps going just fine.  Dim, 34sec, wakeup, ok.  Oddly, even though it says the clock stopped after 35sec, if I wake it up after 44 sec, it works fine.  If I wake it up after 46 sec, it says the clocked stopped 10 sec ago at :35.)

 

(I also tried it using setTimeout() and manually setting the next timer.  No difference, still fails to fire after a while.)

 

This is on a 9700 with OS 5.0.0.330, using the Internet Browser.

 

QUESTION:  Does anyone know a way to keep setInterval firing even after the backlight's gone off???

 

Thanks.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: setTimeout and setInterval not working after backlight times out

Hi There,

 

I believe the browser has a timeout of "X" seconds where if the Browser is no longer the foreground application (or the device goes into sleep mode) that JavaScript will stop executing until the Browser becomes the foreground application again.

 

Does your interval or timeout start working again in their loop and pick-up where they left off after the device comes back on?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
frodo2009
Posts: 1
Registered: ‎02-04-2010
My Device: curve 8900
My Carrier: ATT

Re: setTimeout and setInterval not working after backlight times out

I am having the same problem. Trying to issue a page refresh and force the user to re-authenticate, but the Curve 8900 goes to sleep and script stops working. Any help will be greatly appreciated.

Please use plain text.
New Developer
alexscript
Posts: 8
Registered: ‎09-22-2009
My Device: Not Specified

Re: setTimeout and setInterval not working after backlight times out

I have the same issue. I have a setInterval object that sends an ajax request for updated information in a public feed. However it quits as soon as the backlight is turned off and the blackberry goes into sleep or stand by mode.

 

I know of a few possible workarounds:

 

-Changing the settings on the BlackBerry so the backlight never turns off ... (not so good on battery life)

-Providing the user with a refresh button if they notice the information not updating ... (not very intuitive)

 

Does anyone know of either a way to KEEP the setInterval running during sleep or stand by mode?

OR does anyone know of a way to determine that you are comming BACk from sleep or standy by mode and to resume the setInterval automatically?

 

Any help would be greatly apreciated.

 

Thank you,

 

Alex

Please use plain text.
Contributor
akhanmir
Posts: 14
Registered: ‎06-06-2011
My Device: bold 8900
My Carrier: ufone

Re: setTimeout and setInterval not working after backlight times out

has any one find out the solution of it kindly tell... :smileysad: i am having the same problem :smileysad:  my setinterval and settimeout stops working after backlight goes out :smileysad:

 

suggestions needed urgently

Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: setTimeout and setInterval not working after backlight times out

Hello, 

It is not a solution, is plus a possible idea.

 Create an extension in java similar to the setinterval function of Javascript, when the device is put to sleep this places the navigator in hibernation and all the code Javascript is stopped.

 If you manage to make the extension please they publish it.

Please use plain text.
Contributor
akhanmir
Posts: 14
Registered: ‎06-06-2011
My Device: bold 8900
My Carrier: ufone

Re: setTimeout and setInterval not working after backlight times out


hi all

 

i didnt make any extension but what i think is that i can solve my problem after inclosing my page in a browser.field

 

there i can use all the rimlet api's as well. as i m going to develop web for BB :smileyhappy:

 

 

Please use plain text.
Contributor
nubitol
Posts: 12
Registered: ‎12-03-2010
My Device: Not Specified

Re: setTimeout and setInterval not working after backlight times out

I've got the similar problem. Would you please tell me the details how to solve the problem?
Please use plain text.
Contributor
akhanmir
Posts: 14
Registered: ‎06-06-2011
My Device: bold 8900
My Carrier: ufone

Re: setTimeout and setInterval not working after backlight times out

actually what i m doing is that i will call the webpage through an application. see sample code in BB jde for browser field..

 

by enclosing it in an application u will be able to use rim api's and then increase the time of backlight property

Please use plain text.