Hello,
How to fetch time when user has closed an app in PowerApps?
Thanks,
Hi @dave8
I don't think there really is a way to get the time someone closes the app. There is no function 'OnClose' or anything, because that would be really difficult. There are many way to close an app, it just wouldn't be very reliable.
A possibility however, although not a very clean one perse, is to use a timer and update every x seconds the current time to a datasource. That way when the app closes, you'll have the last updated time which would be rather close to the time closing the app, give or take a few seconds. Depends how precise you'll have to be and how frequently you'll then update the time.
If you were to start a timer when you start the app and loop it on 10s, you can put in the OnTimerEnd property the code to save the current time to whatever datasource you have. When the app closes, you'll have the closing time plus or minus 10s. Note that you'll have to update to your datasource, and just overwrite it with every update.