protected override void AddNotificationRequestInternal(UM_NotificationRequest request, Action <SA_Result> callback) { var content = new ISN_UNNotificationContent(); content.Title = request.Content.Title; content.Body = request.Content.Body; if (request.Content.BadgeNumber != -1) { content.Badge = request.Content.BadgeNumber; } if (string.IsNullOrEmpty(request.Content.SoundName)) { content.Sound = ISN_UNNotificationSound.DefaultSound; } else { content.Sound = ISN_UNNotificationSound.SoundNamed(request.Content.SoundName); } ISN_UNNotificationTrigger trigger = null; if (request.Trigger is UM_TimeIntervalNotificationTrigger) { var timeIntervalTrigger = (UM_TimeIntervalNotificationTrigger)request.Trigger; trigger = new ISN_UNTimeIntervalNotificationTrigger(timeIntervalTrigger.Interval, timeIntervalTrigger.Repeating); } var ios_request = new ISN_UNNotificationRequest(request.Identifier.ToString(), content, trigger); ISN_UNUserNotificationCenter.AddNotificationRequest(ios_request, callback); }
void DocsExample() { var content = new ISN_UNNotificationContent(); content.Title = "Wake up!"; content.Body = "Rise and shine! It's morning time!"; content.Sound = ISN_UNNotificationSound.DefaultSound; content.Sound = ISN_UNNotificationSound.SoundNamed("MySound.wav"); ISN_NSDateComponents date = new ISN_NSDateComponents(); date.Hour = 7; date.Minute = 0; var trigger = new ISN_UNCalendarNotificationTrigger(date, false); // Create the request object. string identifier = "MorningAlarm"; var request = new ISN_UNNotificationRequest(identifier, content, trigger); ISN_UNUserNotificationCenter.AddNotificationRequest(request, (result) => { if (result.IsSucceeded) { Debug.Log("Notification Request Added. "); } else { Debug.Log("Error: " + result.Error.Message); } }); ISN_UNUserNotificationCenterDelegate.WillPresentNotification.AddListener((ISN_UNNotification notification) => { //Do something }); var notificationResponse = ISN_UNUserNotificationCenterDelegate.LastReceivedResponse; ISN_UIApplication.RegisterForRemoteNotifications(); ISN_UIApplication.ApplicationDelegate.DidRegisterForRemoteNotifications.AddListener((result) => { if (result.IsSucceeded) { var token = result.DeviceTokenUTF8; Debug.Log("ANS token string:" + token); } else { Debug.Log("Error: " + result.Error.Message); } }); }