The life of an app
An app is not a lonely island. It is always executed by the operating system within the bounds that it imposes. Depending on the type of the app, we could be interested in responding to different application life cycle events that the operating system sends to it. Every operating system has a slightly different app life cycle model, but in the case of mobile platforms, the trickiest part is properly handling the situation when our apps move from foreground execution to the background and back again.
FireMonkey provides a common abstraction for handling the application life cycle through different types of application events defined in the FMX.Platform
unit, as shown in the following code:
type TApplicationEvent = (FinishedLaunching, BecameActive, WillBecomeInactive, EnteredBackground, WillBecomeForeground, WillTerminate, LowMemory, TimeChange, OpenURL);
If we want to receive the app life cycle events...