public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method // create a new window instance based on the screen size Window = new UIWindow(UIScreen.MainScreen.Bounds); // If you have defined a root view controller, set it here: Window.RootViewController = new RootViewController(); var keys = new object[] { "UserAgent" }; var objects = new object[] { "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E233" }; var dictionnary = NSDictionary.FromObjectsAndKeys(objects, keys); NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionnary); // make the window visible Window.MakeKeyAndVisible(); Setup.EnableCrashReporting(() => { var crashlytics = Crashlytics.SharedInstance; crashlytics.DebugMode = true; Crashlytics.StartWithAPIKey("bc21b872cc8e1a687fe564093d1618a4e165179d"); Fabric.With(new NSObject[] { crashlytics }); AppDomain.CurrentDomain.UnhandledException += (sender, e) => { Setup.CaptureManagedInfo(e.ExceptionObject); Setup.CaptureStackFrames(e.ExceptionObject); Setup.ThrowExceptionAsNative(e.ExceptionObject); }; TaskScheduler.UnobservedTaskException += (sender, e) => { Setup.CaptureManagedInfo(e.Exception); Setup.CaptureStackFrames(e.Exception); Setup.ThrowExceptionAsNative(e.Exception); }; }, Path.GetFileNameWithoutExtension(typeof(AppDelegate).Module.Name)); // We use NSUserDefaults to store a bool value if we are tracking the user or not var optionsDict = NSDictionary.FromObjectAndKey(new NSString("YES"), new NSString(AllowTrackingKey)); NSUserDefaults.StandardUserDefaults.RegisterDefaults(optionsDict); // User must be able to opt out of tracking Gai.SharedInstance.OptOut = !NSUserDefaults.StandardUserDefaults.BoolForKey(AllowTrackingKey); // Initialize Google Analytics with a 5-second dispatch interval (Use a higher value when in production). There is a // tradeoff between battery usage and timely dispatch. Gai.SharedInstance.DispatchInterval = 5; Gai.SharedInstance.TrackUncaughtExceptions = true; Tracker = Gai.SharedInstance.GetTracker("AdeccoNL", TrackingId); return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method var infoDict = NSDictionary.FromFile("Info.plist"); var fabricDict = (NSDictionary)infoDict["Fabric"]; var apiKey = fabricDict["APIKey"].ToString(); Console.WriteLine("API KEY: {0}", apiKey); Setup.EnableCrashReporting(() => { var crashlytics = Crashlytics.SharedInstance; crashlytics.DebugMode = true; Crashlytics.StartWithAPIKey(apiKey); Fabric.With(new NSObject[] { crashlytics }); AppDomain.CurrentDomain.UnhandledException += (sender, e) => { Setup.CaptureManagedInfo(e.ExceptionObject); Setup.CaptureStackFrames(e.ExceptionObject); Setup.ThrowExceptionAsNative(e.ExceptionObject); }; TaskScheduler.UnobservedTaskException += (sender, e) => { Setup.CaptureManagedInfo(e.Exception); Setup.CaptureStackFrames(e.Exception); Setup.ThrowExceptionAsNative(e.Exception); }; }, Path.GetFileNameWithoutExtension(typeof(AppDelegate).Module.Name)); return(true); }