Looking for a way to make a timer fire the "OnTimerEnd" event early. The problem I am trying to solve: I have created a loading screen that pre-loads all data into Collections, and also checks the app version against a remote share point list in order to verify they are running the latest version and forcing them to update if they are not. Right now this process can take anywhere between 1-3 seconds depending on connectivity from a mobile device. I have 5 second timer that navigates to the home screen upon Timer End.
However, this app may be opened many times each day and I'd like to configure it so that instead of having to wait the full 5 seconds, if load finishes after 1 second it goes ahead to the main screen to save my users some time throughout the day and make it more user friendly.
I've tried the following:
1. I had two timers, one for my full load time and one that checked every 750ms to see if the conditions had been met and if they had to go to the load screen. The "early detection" timer was set to auto pause. However, I ran into an issue where when the condition would be met and the user would navigate to the main screen the timer would continue to run in the background even though auto pause was selected. This meant if a user selected a button from the main screen it would load that screen and then immediately navigate to the home screen again (each time the timer was firing the OnTimerEnd event).
Setting it to auto pause or setting an update context variable and placing that in the "start" field of each timer did not seem to resolve this. (Interesting note, this didn't occur on the web player, only on mobile version).
Any ideas on how to accomplish what I'm trying to do?
Instead of depending on a Timer, would you want to consider moving to an explicit loading pattern? Meaning, instead of having an arbitrary loading time, could you check more explicitly that your loading functions have completed, before navigating the user? Ultimately this solves both quick-loading and slow-loading scenarios appropriately for the user, based on their specific scenario.
There are a few suggestions
I would definitely be interested in that. I was originally doing that in the following method (Without a timer) in OnVisible of Screen.
1. Load Collections
2. Load Version Number
3. Do Comparison of Version Number (local vs retrieved). Navigate if appropriate, otherwise show error.
This worked for the most part, unless the server was not reachable, then it would hang. Maybe I need to force a timeout on my retrieval and set a variable or something if its forced exit?
Handling the 'hanging' perception, or slowness, for Users is an important consideration. As long as they believe something is happening, and in an appropriate amount of time, then they will happily wait.
PowerApps does, unfortunately, give the impression of being frozen when it has a long-running process. Some will cause even an animated GIF to freeze in the app, such as a complicated ForAll statement. My example below shows this when it gets to the point of creating/loading a matrix of records - that ForAll function is relatively intense, and even an animated image locks up.
Here I combined a loading spinner Image, and a pattern of collecting a 'progress' record in each loop of a ForAll function. The width of a Shape increments as a percentage of ( CountRows / Total ).
How are you doing the License retrieval? It may be possible to introduce an error-handling mechanism, but limited connectivity/timeouts are usually not easily handled in an app.
Check out the on demand sessions that are available now!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
Features releasing from October 2020 through March 2021