private AndroidNotification parseNotificationTemplate(AndroidNotificationTemplate template) { AndroidNotification newNotification = new AndroidNotification() { Title = template.Title, Text = template.Text, SmallIcon = template.SmallIcon, LargeIcon = template.LargeIcon, Style = template.NotificationStyle, FireTime = System.DateTime.Now.AddSeconds(template.FireInSeconds), Color = template.Color, Number = template.Number, ShouldAutoCancel = template.ShouldAutoCancel, UsesStopwatch = template.UsesStopWatch, Group = template.Group, GroupSummary = template.GroupSummary, SortKey = template.SortKey, IntentData = template.IntentData, ShowTimestamp = template.ShowTimestamp, RepeatInterval = TimeSpan.FromSeconds(template.RepeatInterval), //ShowInForeground = template.ShowInForeground }; return(newNotification); }
IEnumerator RunCustomSequence() { AndroidNotificationTemplate ant = AndroidNotificationsTemplates[4]; SendNotification(parseNotificationTemplate(ant), ant.Channel, 15); SendNotification(parseNotificationTemplate(ant), ant.Channel, 20); SendNotification(parseNotificationTemplate(ant), ant.Channel, 28); SendNotification(parseNotificationTemplate(ant), ant.Channel, 14); yield return(new WaitForSeconds(ant.FireInSeconds + 5)); AndroidNotificationCenter.CancelNotification(15); yield return(new WaitForSeconds(5)); AndroidNotificationCenter.CancelDisplayedNotification(20); yield return(new WaitForSeconds(5)); SendNotification(parseNotificationTemplate(ant), ant.Channel, 99); SendNotification(parseNotificationTemplate(ant), ant.Channel, 99); yield return(new WaitForSeconds(ant.FireInSeconds - 1)); SendNotification(parseNotificationTemplate(ant), ant.Channel, 99); SendNotification(parseNotificationTemplate(ant), ant.Channel, 99); }