コード例 #1
0
        public void Notify(string title, string body, int id)
        {
            UILocalNotification loggedOutNotification = new UILocalNotification();

            loggedOutNotification.AlertBody      = body;
            loggedOutNotification.AlertAction    = title;
            loggedOutNotification.TimeZone       = NSTimeZone.DefaultTimeZone;
            loggedOutNotification.RepeatInterval = 0;            //default "The default value is 0, which means that the system fires the notification once and then discards it."
            loggedOutNotification.FireDate       = (NSDate)DateTime.Now;

            _application.ScheduleLocalNotification(loggedOutNotification);
        }
コード例 #2
0
ファイル: AppDelegate.cs プロジェクト: paket-core/mobile
        private void PublishLocalNotification(string name, string text, UIApplication application)
        {
            // create the notification
            var notification = new UILocalNotification();

            // set the fire date (the date time in which it will fire)
            notification.FireDate = NSDate.FromTimeIntervalSinceNow(1);

            // configure the alert
            notification.AlertAction = name;
            notification.AlertBody   = text;

            // modify the badge
            notification.ApplicationIconBadgeNumber = 0;

            // set the sound to be the default sound
            notification.SoundName = UILocalNotification.DefaultSoundName;

            // schedule it
            application.ScheduleLocalNotification(notification);
        }