public override void OnCreate() { DefaultNightMode = QApis.AreAvailable ? ModeNightFollowSystem : ModeNightAuto; base.OnCreate(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); #if !DEBUG Firebase.FirebaseApp.InitializeApp(this); #endif AndroidDependencyContainer.EnsureInitialized(Context); var app = new AppStart(AndroidDependencyContainer.Instance); app.LoadLocalizationConfiguration(); var accessLevel = app.GetAccessLevel(); app.SetupBackgroundSync(); app.SetFirstOpened(); if (accessLevel == AccessLevel.TokenRevoked || accessLevel == AccessLevel.LoggedIn) { AndroidDependencyContainer.Instance .UserAccessManager .LoginWithSavedCredentials(); } var accessibilityManager = GetSystemService(AccessibilityService) as AccessibilityManager; if (accessibilityManager != null) { var accessibilityEnabled = accessibilityManager.IsTouchExplorationEnabled; AndroidDependencyContainer.Instance.AnalyticsService.AccessibilityEnabled.Track(accessibilityEnabled); } #if USE_APPCENTER Microsoft.AppCenter.AppCenter.Start( "{TOGGL_APP_CENTER_ID_DROID}", typeof(Microsoft.AppCenter.Crashes.Crashes), typeof(Microsoft.AppCenter.Analytics.Analytics)); #endif #if DEBUG // Add or remove `Detect*` chains to detect unwanted behaviour // Change the `Penalty*` to change how the StrictMode works, allowing it to crash the app if necessary // Try not to misinterpret the logs/penalties; You should only be looking for behaviour that shouldn't // be happening Android.OS.StrictMode.SetVmPolicy( new Android.OS.StrictMode.VmPolicy.Builder() .DetectActivityLeaks() .DetectLeakedClosableObjects() .DetectLeakedRegistrationObjects() .DetectLeakedSqlLiteObjects() .PenaltyLog() .Build()); Android.OS.StrictMode.SetThreadPolicy( new Android.OS.StrictMode.ThreadPolicy.Builder() .DetectCustomSlowCalls() .PenaltyLog() .Build()); #endif }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { #if !USE_PRODUCTION_API System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; #endif #if !DEBUG Firebase.Core.App.Configure(); #endif UNUserNotificationCenter.Current.Delegate = this; UIApplication.SharedApplication.RegisterForRemoteNotifications(); Messaging.SharedInstance.Delegate = this; initializeAnalytics(); Window = new UIWindow(UIScreen.MainScreen.Bounds); Window.MakeKeyAndVisible(); setupNavigationBar(); setupTabBar(); IosDependencyContainer.EnsureInitialized(Window, this); var app = new AppStart(IosDependencyContainer.Instance); app.LoadLocalizationConfiguration(); app.UpdateOnboardingProgress(); app.SetFirstOpened(); app.SetupBackgroundSync(); var accessLevel = app.GetAccessLevel(); loginWithCredentialsIfNecessary(accessLevel); navigateAccordingToAccessLevel(accessLevel, app); var accessibilityEnabled = UIAccessibility.IsVoiceOverRunning; IosDependencyContainer.Instance.AnalyticsService.AccessibilityEnabled.Track(accessibilityEnabled); var watchservice = new WatchService(); watchservice.TryLogWatchConnectivity(); #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif return(true); }