web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Timer stops counting d...
Power Apps
Unanswered

Timer stops counting down when browser tab focus changes

(0) ShareShare
ReportReport
Posted on by 17

I have a timer on my PowerApp.  If I have 2 or 3 other tabs open, if the timer is running and I change tabs, the timer stops. It won't continue so I can do other things in other tabs while it's running.

However, if I have the PowerApp in its' own browser window, it will run just fine if I'm working in another browser session.

 

How can I make the timer always continue to run regardless of if I'm working in another tab?

 

I tried to include a video of the problem but I cannot upload mp4 files.

Categories:
  • SeanHenderson Profile Picture
    1,104 on at

    Hi @StraighterSwing 

    This is a browser issue. I know Chrome throttles background timers in order to conserve resources and save battery life. 

    You can try other browsers to see if they have different resource allocation for background tabs, but I think it is quickly becoming industry standard.

    Unfortunately, there is nothing that can be done to affect this in Power Apps.

     

    ---
    Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @StraighterSwing ,

     

    The problem also occurs on the ios client when you switch to another app and PowerApps client is running in the background, the timer stops counting down. I'm not sure if this is a design flaw, but you can feedback this to PowerApps, just submit an idea to PowerApps Ideas Forum.

    As an alternative workaround, please modify your Timer control as below:

    1. Set Duration: 1000

    2. Set OnSelect: 

     

    Set(StartTime, Now());
    Set(Now, Now())

     

    3. Set OnTimerStart: 

     

    Set(Now, Now())

     

    4. Set Text: 

     

     Text(Time(0, 0, DateDiff(StartTime,Now,Seconds)), "[$-en-US]hh:mm:ss")

     

     Then it will be like this:

    StoG_18.gif

    Sik

  • StraighterSwing Profile Picture
    17 on at

    Thank you for the suggestion but I don't think that'd work for a countDOWN timer.  My timer counts down so I don't think using Now() will work in this case.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Do you mean countdown?

    You can try this, take 10 seconds as an example:

    Set OnSelect property: 

     

    Set(StartTime, DateAdd(Now(),10,Seconds));
    Set(Now, Now())

     

    Set OnTimerStart : 

     

    Set(Now, Now())

     

    Set repeat: 

     

    If(Timer1.Text="00:00:00",false,true)

     

    Set Duration: 1000

    Set Text: 

     

     Text(Time(0, 0, DateDiff(Now,StartTime,Seconds)), "[$-en-US]hh:mm:ss")

     

    Then the timer will countdown from 10s - 0s.

    If this doesn't make sense, please submit an idea to PowerApps Ideas Forum.

    Sik

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @v-siky-msft 

     

    We never encounter this but in case for future, we are also interested to keep this in mind in case.

     

    So you claim that Timer does not work in background?

    Actually we presumed this. We thought the PowerApps Timer may not work in background when app is not active.

     

    However, we may be interested in your workaround to force timer to work in the background, including in cases where the underlying framework may put the Timer to sleep.

     

    So for timer to work in Background, you are making the time duration shorter (1 second), auto repeating timer, and setting variable each time?

     

    Why does it work to do this??

     

    Is your setting of the variable all the time causing the app to remain awake in the background by force?

     

    Why does your workaround cause the Timer to work in background effectively whereas supposedly if you do not do this, the Timer doesn't work in the background without this workaround?

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    The timer background shutdown is the result of our testing. I am here to provide an alternative solution. 

    In my solution, the Timer text is calculated in two times (StartTime - Now), Time can not be affected by background dormancy. The StartTime is set and the current time(Now) is updated every second, then the Timer Text shows the calculated result, Time countdown.

    Sik

     

     

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @v-siky-msft 

     

    Ah, thank you for clarifying.

     

    So actually the trick is, the Timer is retrieving value of time passed, now it makes sense. 

     

    In your GIF now we understood why the old amount of time still showed for split second.

    Because it was not a workaround to dormancy, it was a workaround to still keep track of amount of time being passed even after it was made dormant, and to update right away when made awake again.

     

    So if suppose something had to actually happen when countdown ended exactly and while still dormant, this would not work.

     

    However, it could still work, if it was OK for the countdown action to be performed immediately when the app is made awake again, even if it means it could be later than the literal countdown time (i.e. not until app was made awake again at the minimum).

     

    This is great alternative solution @v-siky-msft considering the limitation.

     

    This would be similar to something we might do under these conditions

    Aside from your idea, we would be unsure how to do it while the app was dormant and countdown timer literally enforced even if it was dormant. Your alternative is very great though considering the limits.

     

  • daniromero89 Profile Picture
    45 on at

    Is it possible to do this automatically?

     

    I have tried doing these steps but there is an error when I do it on Autostart.

  • djams18 Profile Picture
    2 on at
    How do you make the label return to 00:00:00?

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi  @v-siky-msft,

    The timer doesn't start when I click it. 

    Is there any other setup needed to make the below work? I tried replicating the GIF in a new/blank canvas but it doesn't start when I click on it. 😞

    1. Set Duration: 1000

    2. Set OnSelect: 

     

    Set(StartTime, Now());
    Set(Now, Now())

     

    3. Set OnTimerStart: 

     

    Set(Now, Now())

     

    4. Set Text: 

     

     Text(Time(0, 0, DateDiff(StartTime,Now,Seconds)), "[$-en-US]hh:mm:ss")

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard