How can I count the time it takes from the moment the user presses the launch button on the home screen until the moment the app is active (for example, until the viewDidAppear
A simple implementation is to start a StopWatch
in the applications main and then grab the time result in the ViewDidAppear
method:
public class Application
{
public static Stopwatch StartUpTimer;
static void Main(string[] args)
{
StartUpTimer = new Stopwatch();
StartUpTimer.Start();
UIApplication.Main(args, null, "AppDelegate");
}
}
public class MyUIViewController : UIViewController
{
public override void ViewDidAppear (bool animated)
{
Console.WriteLine (Application.StartUpTimer.ElapsedMilliseconds.ToString () + "ms to startup");
base.ViewDidAppear (animated);
}
}