×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    5

    Javascript Timer paused while Widget is in background or Power-Save mode is on

    How can I allow my widget to run in the background (or while power-save is turned on). It seems that my trigger (setInterval(updateStatus, 1000)) does not work during this time, it simply stops until the widget is brought back to focus.

    I read that this possibly is an error to be fixed, someone please confirm this is a design error and a fix is coming (and when) or if this is normal practice and please if someone knows a workaround let me know! It is no good running a counter when it stops counting all the time!

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Hello,

    Welcome to Forum!

    You have probably already read this known issue:
    http://wiki.forum.nokia.com/index.ph..._BrowserNG/7.1

    So as said, timers are stopped when widget is in background, in case there is home screen widgets on HS. This is intended behavior e.g. N97.

    However, this is not the case with devices that does not support HS, like 3.2 devices running on browser 7.1 (E52 etc..). For these devices timer should run on the background and this could be fixed in upcoming firmware updates.

    Summary:
    N97, N97 mini - timers are stopped in case widget is on background and there is at least one widget on HS. Intended behavior.
    Other devices running browser 7.1 (no HS) - timers are stopped when widget is in background. This issue will be fixed.

    Hope this clarifies this issue a bit.

    Br,
    Ilkka - Forum Nokia

  3. #3
    Registered User
    Join Date
    Feb 2004
    Posts
    24

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Hi there,

    I was actually puzzled with issue as well. IMHO, HS widgets are especially useful when i need to check for data changes on, lets say, a server and alert the user on the device when changes are detected. The current implementation makes it impossible to periodically check for changes. Why doesn't Nokia add an attribute in, for example, info.plist to allow this?

    This capability is critical for many applications.

    cheers
    Rafi

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Hi Rafi,

    HomeScreen widgets can actually do periodical checks or actions. What cannot be done (if I've correctly understood) is to have a running background widget when there is (at least) a HomeScreen widget visible.

    Pit

  5. #5
    Registered User
    Join Date
    Feb 2004
    Posts
    24

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Quote Originally Posted by jappit View Post
    Hi Rafi,

    HomeScreen widgets can actually do periodical checks or actions. What cannot be done (if I've correctly understood) is to have a running background widget when there is (at least) a HomeScreen widget visible.

    Pit
    Hi Jappit,

    How can I perform periodical checks if timers are suspended?
    I actually witness this behavior with a widget I'm developing. All timers are working fine when the the screen is active. When the screen goes dark all timers are suspended until I wake up the phone. Naturally, you can't see this on the emulator as its screen does not go to sleep...I see this on my N97...

    Rafi

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Hi Rafi,

    the answer is no, you can't. Some hacks can be tried, as the one described in this thread:

    http://discussion.forum.nokia.com/fo...d.php?t=158725

    but I'm not sure on how much these can help.

    Pit

  7. #7
    Registered User
    Join Date
    Oct 2009
    Posts
    5

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Quote Originally Posted by isalento View Post
    Summary:
    N97, N97 mini - timers are stopped in case widget is on background and there is at least one widget on HS. Intended behavior.
    Other devices running browser 7.1 (no HS) - timers are stopped when widget is in background. This issue will be fixed.

    Hope this clarifies this issue a bit.

    Br,
    Ilkka - Forum Nokia
    Massive respect for the response but I feel it fair to push for WHEN this fix may be available. I note that the trace function of the location class also fails to fire when the widget is in the background/in power-save. Basically widgets stop - it's like letting us developers drive a ferrari but we cannot leave the driveway.

    I would value Nokias reply.

  8. #8
    Registered User
    Join Date
    Feb 2004
    Posts
    24

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Quote Originally Posted by jappit View Post
    Hi Rafi,

    the answer is no, you can't. Some hacks can be tried, as the one described in this thread:

    http://discussion.forum.nokia.com/fo...d.php?t=158725

    but I'm not sure on how much these can help.

    Pit
    This is not really a solution... in order for the WRT client to wait for server's answer you need to make the AJAX request synchronous. This makes the entire widget hang until the reply....If you want to use async AJAX you need to have an endless loop which sounds just as bad....

    Rafi

  9. #9
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Javascript Timer paused while Widget is in background or Power-Save mode is on

    Hi Rafi,

    probably you can use that hack also with async requests, so avoiding blocking your widget. Anyway, I agree with you that this is not an optimal workaround.

    Pit

Similar Threads

  1. Timer stops when process goes background
    By slayv in forum Symbian
    Replies: 4
    Last Post: 2009-02-02, 12:42
  2. save power while in background
    By molp in forum Mobile Java General
    Replies: 5
    Last Post: 2008-08-15, 19:25
  3. Power Save mode problem
    By AvIsHaY in forum Wired and Wireless interfaces (Closed)
    Replies: 3
    Last Post: 2007-08-26, 20:06
  4. Power save problem on nokia 6230i
    By joserino in forum General Development Questions
    Replies: 0
    Last Post: 2006-03-23, 15:13
  5. Power save and background execution (Nokia 6230)
    By ripiajo in forum Mobile Java General
    Replies: 0
    Last Post: 2005-02-16, 22:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×