Hook to close method on an application level

I want to perform logic whenever my Android app is in the process of being closed, so to avoid duplicating the same logic on each Activity.

Similar to OnCreate() below, which is invoked whenever the app is starting, I need the close/terminate method.

    public class Application : Android.App.Application
    {
        public override void OnCreate()
        {
        }
    }

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Do you want to detect the exit of the app or the whole process been killed? And you could try to write a " BaseActivity " in which you could do something on the lifecycle,and other activity could inherit it.

Sign In or Register to comment.