The lifecycle of an app contains the sequence of methods that are called from the time the app is launched until the time it is in the memory. The Lifecycle methods allow developers to write code for initialization or logic or transition so that the app components are initialized or show a specific behavior as and when they transit from one state to another. The developer may want to save state, initialize graphical components with data or reset apps state or free memory during these App methods.
The various life cycle methods of XamarinForms Apps are:
OnStart: when the application initializes onStart is called. It is the best place to initialize objects.
OnSleep: Once the application goes to the background, the state is called ‘resume’. The app does not die here, rather is kept in memory but with reduced priority. OnSleep() is similar to OnPause() in Android
OnResume: OnResume is called when the application is resumed, i.e after being sent to the background. Similar to OnResume on Android.