コード例 #1
0
            PresentationOption GetPresentationOptions(bool oAlert, bool oBadge, bool oSound)
            {
                PresentationOption options = PresentationOption.None;

                if (oAlert)
                {
                    options |= PresentationOption.Alert;
                }
                if (oBadge)
                {
                    options |= PresentationOption.Badge;
                }
                if (oSound)
                {
                    options |= PresentationOption.Sound;
                }
                return(options);
            }
コード例 #2
0
    //Send Simple Notification
    string SendSimpleNotification4Seconds(string title = "SendSimpleNotification4Seconds", string thread = "thread_1", bool repeat = false, int seconds = 4, int minutes = 0, PresentationOption foregroundOption = PresentationOption.Alert, int badge = -1)
    {
        Debug.Log("SendSimpleNotification4Seconds");
        var timeTrigger = new iOSNotificationTimeIntervalTrigger()
        {
            TimeInterval = new TimeSpan(0, minutes, seconds),
            Repeats      = repeat
        };

        iOSNotification n = new iOSNotification()
        {
            Title                        = title,
            Body                         = "Scheduled at: " + DateTime.Now.ToShortDateString() + " triggered in 5 seconds",
            Subtitle                     = "This is a subtitle, something, something important...",
            ShowInForeground             = true,
            ForegroundPresentationOption = foregroundOption,
            CategoryIdentifier           = "category_a",
            ThreadIdentifier             = thread,
            Trigger                      = timeTrigger,
            Data                         = "data_SendSimpleNotification4Seconds",
        };

        /* if (badge >= 0)
         *  n.Badge = badge + 1;*/

        iOSNotificationCenter.ScheduleNotification(n);

        return(n.Identifier);
    }