public List <LocalNotificationTemplate> LoadPendingNotifications(bool includeAll = false) { string data = string.Empty; if (PlayerPrefs.HasKey(PP_KEY)) { data = PlayerPrefs.GetString(PP_KEY); } List <LocalNotificationTemplate> tpls = new List <LocalNotificationTemplate>(); if (data != string.Empty) { string[] notifications = data.Split(DATA_SPLITTER [0]); foreach (string n in notifications) { LocalNotificationTemplate notification = new LocalNotificationTemplate(n); if (!notification.IsFired || includeAll) { tpls.Add(notification); } } } return(tpls); }
public List <LocalNotificationTemplate> LoadPendingNotifications() { string data = string.Empty; if (PlayerPrefs.HasKey(PP_KEY)) { data = PlayerPrefs.GetString(PP_KEY); } List <LocalNotificationTemplate> tpls = new List <LocalNotificationTemplate>(); if (data != string.Empty) { string[] notifications = data.Split(DATA_SPLITTER [0]); foreach (string n in notifications) { String templateData = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(n)); LocalNotificationTemplate notification = new LocalNotificationTemplate(templateData); if (!notification.IsFired) { tpls.Add(notification); } } } return(tpls); }
public List <LocalNotificationTemplate> LoadPendingNotifications(bool includeAll = false) { #if UNITY_ANDROID string data = string.Empty; if (PlayerPrefs.HasKey(PP_KEY)) { data = PlayerPrefs.GetString(PP_KEY); } List <LocalNotificationTemplate> tpls = new List <LocalNotificationTemplate>(); if (data != string.Empty) { string[] notifications = data.Split(DATA_SPLITTER [0]); foreach (string n in notifications) { String templateData = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(n)); try { LocalNotificationTemplate notification = new LocalNotificationTemplate(templateData); if (!notification.IsFired || includeAll) { tpls.Add(notification); } } catch (Exception e) { Debug.Log("AndroidNative. AndroidNotificationManager loading notification data failed: " + e.Message); } } } return(tpls); #else return(null); #endif }
public int ScheduleLocalNotification(AndroidNotificationBuilder builder) { AN_NotificationProxy.ScheduleLocalNotification(builder); LocalNotificationTemplate notification = new LocalNotificationTemplate(builder.Id, builder.Title, builder.Message, DateTime.Now.AddSeconds(builder.Time)); List <LocalNotificationTemplate> scheduled = LoadPendingNotifications(); scheduled.Add(notification); SaveNotifications(scheduled); return(builder.Id); }
public int ScheduleLocalNotification(string title, string message, int seconds) { int id = GetNextId; AndroidNative.ScheduleLocalNotification(title, message, seconds, id); LocalNotificationTemplate notification = new LocalNotificationTemplate(id, title, message, DateTime.Now.AddSeconds(seconds)); List <LocalNotificationTemplate> scheduled = LoadPendingNotifications(); scheduled.Add(notification); SaveNotifications(scheduled); return(id); }