Beispiel #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Create a Accept action
            UIMutableUserNotificationAction acceptAction = new UIMutableUserNotificationAction()
            {
                Identifier             = "ACCEPT_ID",
                Title                  = "Accept",
                ActivationMode         = UIUserNotificationActivationMode.Background,
                Destructive            = false,
                AuthenticationRequired = false
            };

            // Create a Reply action
            UIMutableUserNotificationAction replyAction = new UIMutableUserNotificationAction()
            {
                Identifier             = "REPLY_ID",
                Title                  = "Reply",
                ActivationMode         = UIUserNotificationActivationMode.Foreground,
                Destructive            = false,
                AuthenticationRequired = true
            };

            // Create a Trash action
            UIMutableUserNotificationAction trashAction = new UIMutableUserNotificationAction()
            {
                Identifier             = "TRASH_ID",
                Title                  = "Trash",
                ActivationMode         = UIUserNotificationActivationMode.Background,
                Destructive            = true,
                AuthenticationRequired = true
            };

            // Create MonkeyMessage Category
            UIMutableUserNotificationCategory monkeyMessageCategory = new UIMutableUserNotificationCategory();

            monkeyMessageCategory.Identifier = "MONKEYMESSAGE_ID";
            monkeyMessageCategory.SetActions(new UIUserNotificationAction[] { acceptAction, replyAction, trashAction }, UIUserNotificationActionContext.Default);
            monkeyMessageCategory.SetActions(new UIUserNotificationAction[] { acceptAction, trashAction }, UIUserNotificationActionContext.Minimal);

            // Create a category group
            NSSet categories = new NSSet(monkeyMessageCategory);

            // Set the requested notification types
            UIUserNotificationType type = UIUserNotificationType.Alert | UIUserNotificationType.Badge;

            // Create the setting for the given types
            UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes(type, categories);

            // Register the settings
            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);

            //Completed
            return(true);
        }
		public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
		{
			// Create a Accept action
			UIMutableUserNotificationAction acceptAction = new UIMutableUserNotificationAction (){
				Identifier = "ACCEPT_ID",
				Title = "Accept",
				ActivationMode = UIUserNotificationActivationMode.Background,
				Destructive = false,
				AuthenticationRequired = false
			};

			// Create a Reply action
			UIMutableUserNotificationAction replyAction = new UIMutableUserNotificationAction () {
				Identifier = "REPLY_ID",
				Title = "Reply",
				ActivationMode = UIUserNotificationActivationMode.Foreground,
				Destructive = false,
				AuthenticationRequired = true
			};

			// Create a Trash action
			UIMutableUserNotificationAction trashAction = new UIMutableUserNotificationAction (){
				Identifier = "TRASH_ID",
				Title = "Trash",
				ActivationMode = UIUserNotificationActivationMode.Background,
				Destructive = true,
				AuthenticationRequired = true
			};

			// Create MonkeyMessage Category
			UIMutableUserNotificationCategory monkeyMessageCategory = new UIMutableUserNotificationCategory ();
			monkeyMessageCategory.Identifier = "MONKEYMESSAGE_ID";
			monkeyMessageCategory.SetActions (new UIUserNotificationAction[]{ acceptAction, replyAction, trashAction }, UIUserNotificationActionContext.Default);
			monkeyMessageCategory.SetActions (new UIUserNotificationAction[]{ acceptAction, trashAction }, UIUserNotificationActionContext.Minimal);

			// Create a category group
			NSSet categories = new NSSet(monkeyMessageCategory);

			// Set the requested notification types
			UIUserNotificationType type = UIUserNotificationType.Alert | UIUserNotificationType.Badge;

			// Create the setting for the given types
			UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes(type, categories);

			// Register the settings
			UIApplication.SharedApplication.RegisterUserNotificationSettings (settings);

			//Completed
			return true;
		}
        public static void RegisterNotifications()
        {
            var action = new UIMutableUserNotificationAction
                {
                    Title = "Launch",
                    Identifier = "trade",
                    ActivationMode = UIUserNotificationActivationMode.Foreground,
                    AuthenticationRequired = false
                };

            var actionCategory = new UIMutableUserNotificationCategory { Identifier = "trade" };

            var categories = new NSMutableSet();
            categories.Add(actionCategory);

            actionCategory.SetActions(new UIUserNotificationAction[] { action }, UIUserNotificationActionContext.Default);

            var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Sound, categories);
            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
        }
Beispiel #4
0
        public static void RegisterNotifications()
        {
            var action = new UIMutableUserNotificationAction
            {
                Title                  = "Launch",
                Identifier             = "trade",
                ActivationMode         = UIUserNotificationActivationMode.Foreground,
                AuthenticationRequired = false
            };

            var actionCategory = new UIMutableUserNotificationCategory {
                Identifier = "trade"
            };

            var categories = new NSMutableSet();

            categories.Add(actionCategory);

            actionCategory.SetActions(new UIUserNotificationAction[] { action }, UIUserNotificationActionContext.Default);

            var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Sound, categories);

            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
        }
Beispiel #5
0
		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);
		}