top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What are the life cycle's of Xamarin.forms app development?

+2 votes
73 views
What are the life cycle's of Xamarin.forms app development?
posted Oct 5, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

There are three lifecycle method of xamarin.forms app development.

OnStart,Onsleep,OnResume.

OnStart:-called when the application start.
OnSleep:-Called each time when application goes to the background.
OnResume:-Called when the application is resumed,after being sent to the background.

Note:-There is no method for application termination.expect few cases(e.g.:-Not a Crash)application termination will happen from the OnSleep state, without any additional notifications to your code.

To observe when these methods are called, implement a WriteLine call in each (as shown below) and test on each platform.

protected override void OnStart()
{
Debug.WriteLine ("OnStart");
}
protected override void OnSleep()
{
Debug.WriteLine ("OnSleep");
}
protected override void OnResume()
{
Debug.WriteLine ("OnResume");
}

Note:-When updating older Xamarin.Forms applications (eg. create with Xamarin.Forms 1.3 or older), ensure that the Android main activity includes ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation in the [Activity()] attribute. If this is not present you will observe the OnStart method gets called on rotation as well as when the application first starts. This attribute is automatically included in the current Xamarin.Forms app templates.

@ifour Techno Lab Pvt. Ltd.

answer Mar 20 by Rushabh Verma R.
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...