public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { #if APPCENTER AppCenter.Start( Configuration.Conf.APPCENTER_DIAGNOSTICS_TOKEN, typeof(Analytics), typeof(Crashes)); #endif IOSDependencyInjectionConfig.Init(); LocalesService.Initialize(); UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); new MigrationService().Migrate(); LogUtils.SendAllLogs(); AppDomain.CurrentDomain.UnhandledException += LogUtils.OnUnhandledException; SecureStorageImplementation.DefaultAccessible = Security.SecAccessible.AfterFirstUnlockThisDeviceOnly; HandleLocalNotifications(); BackgroundServiceHandler.PlatformScheduleFetch(); UIUserNotificationSettings notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); application.BeginBackgroundTask("showNotification", () => { }); LayoutUtils.OnLayoutDirectionChange(); return(true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); FormsMaps.Init(); //If the device is running iOS 8, if so we are required to ask for the user's permission to receive notifications if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); } if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (approved, error) => { }); UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(); } LoadApplication(new App(this)); return(base.FinishedLaunching(app, options)); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); CarouselViewRenderer.Init(); //Initialisation et enregistrement Toast DependencyService.Register <ToastNotification>(); ToastNotification.Init(); LoadApplication(new App()); // Request Permissions if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { MessagingCenter.Send <IMessageNotifAuth, bool>(this, "notification", granted); // Do something if needed }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); } return(base.FinishedLaunching(app, options)); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); global::Xamarin.FormsMaps.Init(); DependencyService.Register <IStatusBar>(); DependencyService.Register <IPicturePicker>(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); LoadApplication(new App()); if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { if (!granted) { } }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); } return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { SensusServiceHelper.Initialize(() => new iOSSensusServiceHelper()); // facebook settings Settings.AppID = "873948892650954"; Settings.DisplayName = "Sensus"; Forms.Init(); FormsMaps.Init(); MapExtendRenderer.Init(); ToastNotificatorImplementation.Init(); App app = new App(); LoadApplication(app); uiApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, new NSSet())); _serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; UiBoundSensusServiceHelper.Set(_serviceHelper); app.SensusMainPage.DisplayServiceHelper(UiBoundSensusServiceHelper.Get(true)); return(base.FinishedLaunching(uiApplication, launchOptions)); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); ImageCircleRenderer.Init(); snsClient = new AmazonSimpleNotificationServiceClient(new CognitoAWSCredentials( Keys.AWSCognito, RegionEndpoint.USEast1), RegionEndpoint.USEast1); var manager = BITHockeyManager.SharedHockeyManager; manager.Configure(Keys.HockeyApp); manager.StartManager(); LoadApplication(new App()); var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(pushSettings); app.RegisterForRemoteNotifications(); var x = typeof(Xamarin.Forms.Themes.DarkThemeResources); x = typeof(Xamarin.Forms.Themes.LightThemeResources); x = typeof(Xamarin.Forms.Themes.iOS.UnderlineEffect); return(base.FinishedLaunching(app, options)); }
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 window = new UIWindow(UIScreen.MainScreen.Bounds); firstViewController = Storyboard.InstantiateInitialViewController() as UIViewController; window.RootViewController = firstViewController; window.MakeKeyAndVisible(); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); } // var hello = LocalBhasvicDB.db; return(true); }
public static void InitNotification(UIApplication app, NSDictionary options) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); app.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } if (options != null) { // check for a remote notification if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) { NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary; if (remoteNotification != null) { var body = remoteNotification.Values[0].ValueForKey(new NSString("alert")).ValueForKey(new NSString("body")).ToString(); OnRemoteNotification(body); } } } }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); DependencyService.Register <ToastNotification>(); Xamarin.FormsGoogleMaps.Init("AIzaSyD3YCjiRwumZvVbAKIpoc1Pu2ZSdFJRtPw"); ToastNotification.Init(); TKCustomMapRenderer.InitMapRenderer(); ImageCircleRenderer.Init(); FAB.iOS.FloatingActionButtonRenderer.InitControl(); //ProgressRingRenderer.Init(); LoadApplication(new App()); if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { // Do something if needed }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); } //var x = typeof(Xamarin.Forms.Themes.DarkThemeResources); //x = typeof(Xamarin.Forms.Themes.LightThemeResources); //x = typeof(Xamarin.Forms.Themes.iOS.UnderlineEffect); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // 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 = myViewController; // make the window visible Window.MakeKeyAndVisible(); ///////////////////////////////////////////////////////////// UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Badge, null ); application.RegisterUserNotificationSettings(notificationSettings); } ///////////////////////////////////////////////////////////// return true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); DependencyService.Register <ToastNotification>(); // Register your dependency ToastNotification.Init(); // Request Permissions if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { // Do something if needed }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); } LoadApplication(new App()); AnimationViewRenderer.Init(); ImageCircle.Forms.Plugin.iOS.ImageCircleRenderer.Init(); BadgeView.iOS.CircleViewRenderer.Initialize(); Messier16.Forms.Controls.iOS.PlatformTabbedPageRenderer.Init(); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); } // check for a notification if (launchOptions != null) { // check for a local notification if (launchOptions.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { var localNotification = launchOptions[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { UIAlertController okayAlertController = UIAlertController.Create(localNotification.AlertAction, localNotification.AlertBody, UIAlertControllerStyle.Alert); okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); Window.RootViewController.PresentViewController(okayAlertController, true, null); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } } return true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); } // check for a notification if (options != null) { if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show(); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } } return(base.FinishedLaunching(app, options)); }
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 // Code to start the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif application.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); application.RegisterUserNotificationSettings(settings); window = new UIWindow(UIScreen.MainScreen.Bounds); UINavigationController navCont = new UINavigationController(); //navCont.NavigationController.NavigationBar.Translucent = true; //PokktDemoOptionVC optionVC = new PokktDemoOptionVC("PokktDemoOptionVC", null); //navCont.PushViewController(optionVC, true); //window.RootViewController = navCont; DemoSelector demoSelector = new DemoSelector("DemoSelector", null); navCont.PushViewController(demoSelector, true); window.RootViewController = navCont; window.MakeKeyAndVisible(); return(true); }
public override bool FinishedLaunching(UIApplication nativeApp, NSDictionary options) { Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); Xamarin.Forms.Forms.Init(); this.formsApp = new PushNotifClient.App(); LoadApplication(this.formsApp); // Guidelines for notifications: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/Introduction.html#//apple_ref/doc/uid/TP40008194 // App must ask the user for permission, no matter if we're using local or remote notifications. // There is also RegisterForRemoteNotificationTypes() but it is deprecated in iOS8. // NOTE: !Push notifications are not supported on the iOS Simulator! nativeApp.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null)); // Request registration for remote notifications. This will talk to Apple's push server and the app will receive a token // when RegisteredForRemoteNotifications() gets called. This call is non-blocking. nativeApp.RegisterForRemoteNotifications(); return(base.FinishedLaunching(nativeApp, options)); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); } // check for a notification if (launchOptions != null) { // check for a local notification if (launchOptions.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { var localNotification = launchOptions[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { UIAlertController okayAlertController = UIAlertController.Create(localNotification.AlertAction, localNotification.AlertBody, UIAlertControllerStyle.Alert); okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); Window.RootViewController.PresentViewController(okayAlertController, true, null); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } } return(true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); Xamarin.FormsMaps.Init(); ImageCircleRenderer.Init(); RoundedBoxViewRenderer.Init(); DependencyService.Register <ToastNotification>(); ToastNotification.Init(); LoadApplication(new App()); // Request Permissions if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { }); // Watch for notifications while app is active UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); } return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // 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 = myViewController; // make the window visible Window.MakeKeyAndVisible(); ///////////////////////////////////////////////////////////// UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Badge, null ); application.RegisterUserNotificationSettings(notificationSettings); } ///////////////////////////////////////////////////////////// return(true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); DependencyService.Register <IosDeviceRegistration>(); var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); app.RegisterForRemoteNotifications(); UILocalNotification notification = new UILocalNotification(); notification.FireDate = NSDate.FromTimeIntervalSinceNow(3600); //notification.AlertTitle = "Alert Title"; // required for Apple Watch notifications notification.AlertAction = "View Alert"; notification.AlertBody = "Сашка, я тебя люблю!"; UIApplication.SharedApplication.ScheduleLocalNotification(notification); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { SensusServiceHelper.Initialize(() => new iOSSensusServiceHelper()); // facebook settings Settings.AppID = "873948892650954"; Settings.DisplayName = "Sensus"; Forms.Init(); FormsMaps.Init(); MapExtendRenderer.Init(); // toasts for iOS DependencyService.Register<ToastNotificatorImplementation>(); ToastNotificatorImplementation.Init(); LoadApplication(new App()); uiApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, new NSSet())); _serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; #if UNIT_TESTING Forms.ViewInitialized += (sender, e) => { if (!string.IsNullOrWhiteSpace(e.View.StyleId)) e.NativeView.AccessibilityIdentifier = e.View.StyleId; }; Calabash.Start(); #endif return base.FinishedLaunching(uiApplication, launchOptions); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); SfDataGridRenderer.Init(); DependencyService.Register <ToastNotification>(); ToastNotification.Init(); // Request Permissions if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { // Do something if needed }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(notificationSettings); } LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes (UIUserNotificationType.Alert, null); application.RegisterUserNotificationSettings (notificationSettings); application.RegisterForRemoteNotifications (); return true; }
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(10); application .RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert, null)); return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert, null); application.RegisterUserNotificationSettings(notificationSettings); application.RegisterForRemoteNotifications(); return(true); }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { #if DEBUG Xamarin.Calabash.Start(); #endif // create our window window = new UIWindow (UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible (); home = new Screens.iPhone.Home.Home_iPhone(); home.View.Frame = new CoreGraphics.CGRect (0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height); window.RootViewController = home; // check for a notification if(options != null) { // check for a local notification if(options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if(localNotification != null) { new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show(); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } // check for a remote notification if(options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) { NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary; if(remoteNotification != null) { //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show(); } } } if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes ( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings (notificationSettings); app.RegisterForRemoteNotifications (); } else { //==== register for remote notifications and get the device token // set what kind of notification types we want UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; // register for remote notifications UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } return true; }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // Override point for customization after application launch. UIUserNotificationSettings notificationSettings = UIUserNotificationSettings.GetSettingsForTypes (UIUserNotificationType.Alert, null); app.RegisterUserNotificationSettings (notificationSettings);; app.RegisterForRemoteNotifications (); return true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // check for a notification if (options != null) { // check for a local notification if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show(); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } // check for a remote notification if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) { NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary; if (remoteNotification != null) { //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show(); } } } if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); app.RegisterForRemoteNotifications(); } else { //==== register for remote notifications and get the device token // set what kind of notification types we want UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; // register for remote notifications UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } WireUpLongRunningTask(); global::Xamarin.Forms.Forms.Init(); LoadApplication(new App(null)); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create our window window = new UIWindow(UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible(); home = new Screens.iPhone.Home.Home_iPhone(); home.View.Frame = new CoreGraphics.CGRect(0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height); window.RootViewController = home; // check for a notification if (options != null) { // check for a local notification if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show(); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } // check for a remote notification if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) { NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary; if (remoteNotification != null) { //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show(); } } } if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); app.RegisterForRemoteNotifications(); } else { //==== register for remote notifications and get the device token // set what kind of notification types we want UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; // register for remote notifications UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } return(true); }
void SetupPushNotifications(UIApplication app, NSDictionary options) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); app.RegisterUserNotificationSettings(pushSettings); app.RegisterForRemoteNotifications(); ProcessNotification(options, false); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // Override point for customization after application launch. UIUserNotificationSettings notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert, null); app.RegisterUserNotificationSettings(notificationSettings);; app.RegisterForRemoteNotifications(); return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Localization: // https://docs.microsoft.com/de-de/xamarin/ios/app-fundamentals/localization/ App.SetNotification = SetNotification; var notificationSettings = UIUserNotificationSettings .GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); application.RegisterUserNotificationSettings(notificationSettings); return(true); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { _window = new UIWindow(UIScreen.MainScreen.Bounds); // setup presenter var presenter = new AppPresenter(this, _window); var setup = new Setup(this, presenter); setup.Initialize(); var startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); _window.MakeKeyAndVisible(); if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.CancelAllLocalNotifications(); application.RegisterUserNotificationSettings(notificationSettings); } var session = AVAudioSession.SharedInstance(); NSError categoryError; session.SetCategory(AVAudioSessionCategory.Playback); session.SetActive(true, out categoryError); // check for a notification if (launchOptions != null) { // check for a local notification if (launchOptions.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) { var localNotification = launchOptions[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification; if (localNotification != null) { UIAlertController okayAlertController = UIAlertController.Create(localNotification.AlertAction, localNotification.AlertBody, UIAlertControllerStyle.Alert); okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); Window.RootViewController.PresentViewController(okayAlertController, true, null); // reset our badge UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; } } } return(true);//Facebook.CoreKit.ApplicationDelegate.SharedInstance.FinishedLaunching(application, launchOptions); }
/// <summary> /// 注册苹果推送,获取deviceToken用于推送 /// </summary> static void RegisterAPNS(UIApplication application) { if (System.Convert.ToDouble(UIDevice.CurrentDevice.SystemVersion) >= 8.0) { // iOS 8 Notifications application.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null)); application.RegisterForRemoteNotifications(); } else { // iOS < 8 Notifications UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound); } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var configuracionNotificacion = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings (configuracionNotificacion); } return(true); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); DependencyService.Register <ToastNotification>(); ToastNotification.Init(); XamForms.Controls.iOS.Calendar.Init(); CarouselViewRenderer.Init(); SegmentedControlRenderer.Init(); new SfChartRenderer(); SendAnyPreviousCrash(); //read log file and send crash report if available mainApplication = new App(); MessagingCenter.Subscribe <App, string>(mainApplication, AppConstant.ErrorEvent, (s, error) => { mainApplication.MainPage.DisplayAlert("Error", AppConstant.ErrorText, "Close"); SendErrorEmail(error); }); LoadApplication(mainApplication); #region Pie Chart Title Customization Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => { if (e.NativeView is SFChart) { (e.NativeView as SFChart).Delegate = new ChartCustomDelegate(e.View as SfChart); } }; #endregion if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request Permissions UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) => { // Do something if needed }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings(notificationSettings); } return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes ( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); app.RegisterUserNotificationSettings (notificationSettings); } global::Xamarin.Forms.Forms.Init (); // Code for starting up the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif LoadApplication (new App ()); return base.FinishedLaunching (app, options); }
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { SensusServiceHelper.Initialize(() => new iOSSensusServiceHelper()); // facebook settings Settings.AppID = "873948892650954"; Settings.DisplayName = "Sensus"; Forms.Init(); FormsMaps.Init(); MapExtendRenderer.Init(); ToastNotificatorImplementation.Init(); App app = new App(); LoadApplication(app); uiApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, new NSSet())); _serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; UiBoundSensusServiceHelper.Set(_serviceHelper); app.SensusMainPage.DisplayServiceHelper(UiBoundSensusServiceHelper.Get(true)); if (launchOptions != null) { NSObject launchOptionValue; if (launchOptions.TryGetValue(UIApplication.LaunchOptionsLocalNotificationKey, out launchOptionValue)) ServiceNotificationAsync(launchOptionValue as UILocalNotification); else if (launchOptions.TryGetValue(UIApplication.LaunchOptionsUrlKey, out launchOptionValue)) Protocol.DisplayFromBytesAsync(File.ReadAllBytes((launchOptionValue as NSUrl).Path)); } // service all other notifications whose fire time has passed foreach (UILocalNotification notification in uiApplication.ScheduledLocalNotifications) if (notification.FireDate.ToDateTime() <= DateTime.UtcNow) ServiceNotificationAsync(notification); return base.FinishedLaunching(uiApplication, launchOptions); }
public static void ConnectRCIM(UIApplication application, string appkey, string token) { if (_isIniting || _isInited) return; _isIniting = true; RCIM.SharedRCIM.InitWithAppKey(appkey); RCIM.SharedRCIM.ReceiveMessageDelegate = new IMRMDelegate(); RCIM.SharedRCIM.UserInfoDataSource = new ChatUserDataSource(); if (application.IsRegisteredForRemoteNotifications) { var setting = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); application.RegisterUserNotificationSettings(setting); } else { var myTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; application.RegisterForRemoteNotificationTypes(myTypes); } RCIM.SharedRCIM.ConnectWithToken(token, success => { System.Console.WriteLine("Connect RCIM Success"); _isInited = true; _isIniting = false; }, err => { _isIniting = false; System.Console.WriteLine("Connect RCIM Error : " + err.ToString()); }, () => { _isIniting = false; System.Console.WriteLine("Connect RCIM Error : Auth Token Fail"); }); }
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { SensusServiceHelper.Initialize(() => new iOSSensusServiceHelper()); // facebook settings Settings.AppID = "873948892650954"; Settings.DisplayName = "Sensus"; Forms.Init(); FormsMaps.Init(); MapExtendRenderer.Init(); ToastNotificatorImplementation.Init(); App app = new App(); LoadApplication(app); uiApplication.RegisterUserNotificationSettings(UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, new NSSet())); _serviceHelper = SensusServiceHelper.Get() as iOSSensusServiceHelper; UiBoundSensusServiceHelper.Set(_serviceHelper); app.SensusMainPage.DisplayServiceHelper(UiBoundSensusServiceHelper.Get(true)); return base.FinishedLaunching(uiApplication, launchOptions); }
protected void RegisterNotifications (UIApplication application) { var lightsSwitchAction = new UIMutableUserNotificationAction { Identifier = LightsSwitchIdentifier, Title = "Zet lampen uit en aan", ActivationMode = UIUserNotificationActivationMode.Background, AuthenticationRequired = false, Destructive = true }; var lightsOnAction = new UIMutableUserNotificationAction { Identifier = LightsOnIdentifier, Title = "Zet lampen aan", ActivationMode = UIUserNotificationActivationMode.Background, AuthenticationRequired = false }; var lightsOffAction = new UIMutableUserNotificationAction { Identifier = LightsOffIdentifier, Title = "Zet lampen uit", ActivationMode = UIUserNotificationActivationMode.Background, AuthenticationRequired = false, Destructive = true }; var switchRoomCategory = new UIMutableUserNotificationCategory { Identifier = SwitchRoomCategory }; switchRoomCategory.SetActions (new UIUserNotificationAction[] { lightsSwitchAction, lightsOnAction, lightsOffAction }, UIUserNotificationActionContext.Default); switchRoomCategory.SetActions (new UIUserNotificationAction[] { lightsSwitchAction, lightsOnAction, lightsOffAction }, UIUserNotificationActionContext.Minimal); var enterRoomCategory = new UIMutableUserNotificationCategory { Identifier = EnterRoomCategory }; enterRoomCategory.SetActions (new UIUserNotificationAction[] { lightsOnAction }, UIUserNotificationActionContext.Default); enterRoomCategory.SetActions (new UIUserNotificationAction[] { lightsOnAction }, UIUserNotificationActionContext.Minimal); var leftRoomCategory = new UIMutableUserNotificationCategory { Identifier = LeftRoomCategory }; leftRoomCategory.SetActions (new UIUserNotificationAction[] { lightsOffAction }, UIUserNotificationActionContext.Default); leftRoomCategory.SetActions (new UIUserNotificationAction[] { lightsOffAction }, UIUserNotificationActionContext.Minimal); var categories = new NSSet (switchRoomCategory, enterRoomCategory, leftRoomCategory); var settings = UIUserNotificationSettings.GetSettingsForTypes (UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, categories); application.RegisterUserNotificationSettings (settings); }