Thursday, 29 October 2020

Lifecycle of an App

The lifecycle of an app contains the sequence of methods that are called since 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.



No comments:

Post a Comment

All About .NET MAUI

  What’s .NET MAUI? .NET MAUI (.NET Multi-platform App UI) is a framework for building modern, multi-platform, natively compiled iOS, Androi...

Ads2