Does anyone know of a function that can be triggered when the app is about to exit, close, or go into the background? Essentially any event that indicates "the user has stopped using the app"?
In my app, I create a 'user log' that keeps track of the user's actions within the app. Instead of constantly sending data to the server each time an event occurs, I would like to send all the data at once just before the user stops using the app (whether by closing it completely or sending it to the background).
If such a function exists, where should it be implemented? Should it be placed in the app.js
file, or does it need to be added to every controller within the app?