- Home /
Question by
evance · Jun 04 at 10:37 PM ·
notificationnotificationsnotificationservices
Unity Local Notifications Inconsistency Issue?
I'm trying to implement Unity Local Notifications Package to work on iOS. I got it working on Android easy, but I cannot point to why it is not working on iOS. Here is my code:
TimeSpan diff = DateTime.Parse("06/05/2022 08:30:00") - DateTime.Parse("06/05/2022 00:50:20");
var timeTrigger = new iOSNotificationTimeIntervalTrigger()
{
TimeInterval = diff,
Repeats = false
};
var notification = new iOSNotification()
{
Identifier = "_notification_01",
Title = "Title",
Body = "Scheduled at: " + DateTime.Now.ToShortDateString() + " triggered in 5 seconds",
Subtitle = "This is a subtitle, something, something important...",
ShowInForeground = true,
ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
CategoryIdentifier = "category_a",
ThreadIdentifier = "thread1",
Trigger = timeTrigger,
};
iOSNotificationCenter.ScheduleNotification(notification);
The above does not work but if I change the time to direct timespan, it works: The below code works just fine:
TimeSpan diff = new TimeSpan(0,15,0)
var timeTrigger = new iOSNotificationTimeIntervalTrigger()
{
TimeInterval = diff,
Repeats = false
};
var notification = new iOSNotification()
{
Identifier = "_notification_01",
Title = "Title",
Body = "Scheduled at: " + DateTime.Now.ToShortDateString() + " triggered in 5 seconds",
Subtitle = "This is a subtitle, something, something important...",
ShowInForeground = true,
ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
CategoryIdentifier = "category_a",
ThreadIdentifier = "thread1",
Trigger = timeTrigger,
};
iOSNotificationCenter.ScheduleNotification(notification);
Comment
Your answer
Follow this Question
Related Questions
Notification did not come after transferring time on the phone 0 Answers
Create notification if already there is no notification created 0 Answers
[iOS] NotificationServices.localNotifications is empty when game is minimized 1 Answer
Mobile notifications 0 Answers
Facebook SDK notifications not working 2 Answers