protected override void OnCreate(Bundle bundle) { AppDomain.CurrentDomain.UnhandledException += PlatformError.CurrentDomainUnhandledException; TaskScheduler.UnobservedTaskException += PlatformError.TaskSchedulerUnobservedTaskException; App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density); App.ScreenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density); App.VersionName = Application.ApplicationContext.PackageManager .GetPackageInfo(Application.ApplicationContext.PackageName, 0) .VersionName; AccessibilityManager accessibilityManager = (AccessibilityManager)GetSystemService(AccessibilityService); //NOTE: ref: https://stackoverflow.com/a/12362545 we only use touch exploration events for checking if talkback is enabled accessibilityManager.AddTouchExplorationStateChangeListener(this); Accessibility.AccessibilityEnabled = accessibilityManager.IsTouchExplorationEnabled; Xamarin.Forms.Forms.Init(this, bundle); UserDialogs.Init(this); CarouselViewRenderer.Init(); CachedImageRenderer.Init(true); FlowListView.Init(); Rg.Plugins.Popup.Popup.Init(this, bundle); LocalNotificationsImplementation.NotificationIconId = Resource.Mipmap.notification_icon; //NOTE: We know. Lazy loading of service for platform specific version #pragma warning disable CS0436 // Type conflicts with imported type IWalkingDataService walkingDataService = CrossWalkingDataService.Current; IUpdateService updateService = CrossUpdateService.Current; IScreenshotService screenshotService = CrossScreenshotService.Current; IShareImageService shareImageService = CrossImageShareService.Current; #pragma warning restore CS0436 // Type conflicts with imported type ScreenshotService.Activity = this; ShareImageService.Context = this; CrossServiceContainer.SetWalkingDataService(walkingDataService); CrossServiceContainer.SetUpdateService(updateService); CrossServiceContainer.SetScreenshotService(screenshotService); CrossServiceContainer.SetShareImageService(shareImageService); Log.Debug("MainActivity", "Mainactivity updateservice: " + updateService.ToString()); base.OnCreate(bundle); Instance = this; OnActivityCreated?.Invoke(this); if (Settings.CanRequestReview()) { RequestReview(); } }
public void OnFinishedLaunching(NSDictionary options = null) { AppDomain.CurrentDomain.UnhandledException += PlatformError.CurrentDomainUnhandledException; TaskScheduler.UnobservedTaskException += PlatformError.TaskSchedulerUnobservedTaskException; //NOTE: this is in seconds //UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(Config.BackgroundUpdateIntervalMS / 1000); UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); App.ScreenHeight = (int)UIScreen.MainScreen.Bounds.Height; App.ScreenWidth = (int)UIScreen.MainScreen.Bounds.Width; App.VersionName = NSBundle.MainBundle.InfoDictionary[new NSString("CFBundleVersion")].ToString(); Accessibility.AccessibilityEnabled = UIAccessibility.IsVoiceOverRunning; NSNotificationCenter.DefaultCenter.AddObserver(UIView.VoiceOverStatusDidChangeNotification, notification => Accessibility.AccessibilityEnabled = UIAccessibility.IsVoiceOverRunning); Xamarin.Forms.Forms.Init(); AnimationViewRenderer.Init(); CarouselViewRenderer.Init(); CachedImageRenderer.Init(); Rg.Plugins.Popup.Popup.Init(); CarouselViewRenderer.Init(); CachedImageRenderer.Init(); ShapeRenderer.Init(); FlowListView.Init(); //Setup accessibility callbacks Xamarin.Forms.Forms.Init(); LoadApplication(new App()); GetNotificationPermissions(); //NOTE: We know. Lazy loading of service for platform specific version #pragma warning disable CS0436 // Type conflicts with imported type IWalkingDataService walkingDataService = CrossWalkingDataService.Current; IUpdateService updateService = CrossUpdateService.Current; IScreenshotService screenshotService = CrossScreenshotService.Current; IShareImageService shareImageService = CrossImageShareService.Current; #pragma warning restore CS0436 // Type conflicts with imported type CrossServiceContainer.SetWalkingDataService(walkingDataService); CrossServiceContainer.SetUpdateService(updateService); CrossServiceContainer.SetScreenshotService(screenshotService); CrossServiceContainer.SetShareImageService(shareImageService); Console.WriteLine("Appdelegate unning updateService: " + updateService.ToString()); }
public static void SetShareImageService(IShareImageService shareImageService) { ShareImageService = shareImageService; }
private ShareManager() { _screenshotService = DependencyService.Get <IScreenshotService>(); _shareService = DependencyService.Get <IShareImageService>(); }