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.
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."
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:
4. Set Text:
Text(Time(0, 0, DateDiff(StartTime,Now,Seconds)), "[$-en-US]hh:mm:ss")
Then it will be like this:
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.
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 Duration: 1000
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.
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?
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.
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.
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021