public static List <NotificationData> ListFromString(string playerPrefsString) { List <NotificationData> itemList = new List <NotificationData>(); if (!string.IsNullOrEmpty(playerPrefsString)) { string[] stringList = playerPrefsString.Split(new string[] { Notification_Spacer_Block_Item }, StringSplitOptions.RemoveEmptyEntries); foreach (string playerSingleString in stringList) { NotificationData newItem = FromString(playerSingleString); if (newItem != null) { itemList.Add(newItem); } } } return(itemList); }
private void OnGUI() { float sx = 10; float sy = 10; float w = 100; float h = 20; int index = 3; if (GUI.Button(new Rect(sx, sy + index * h, w, h), "OneTime")) { DateTime fireDateTime = DateTime.Now.AddSeconds(5); string title = "2333"; string body = "sixsixsixxxxxxxxxxsss"; var notiItem = new LocalNotification.NotificationData(title, body, fireDateTime, false); ntf.RegisterNotification(notiItem); } index++; }
public void Register(NotificationData data) { AndroidJavaClass pluginClass = new AndroidJavaClass(MGR_CLASS_NAME); if (pluginClass == null) { return; } string title = data.Title; string message = data.Body; long delayMs = data.FireDelaySeconds * 1000; long timeoutMs = 10000; bool sound = true; string soundName = null; bool vibrate = true; bool lights = true; string bigIcon = ""; Color32 bgColor = new Color32(255, 255, 255, 222); string channel = "default"; Action[] actions = null; int id = new System.Random().Next(); if (data.Repeat) { pluginClass.CallStatic("SetRepeatingNotification", id, delayMs, title, message, message, timeoutMs, sound ? 1 : 0, soundName, vibrate ? 1 : 0, lights ? 1 : 0, bigIcon, "notify_icon_small", ToInt(bgColor), bundleIdentifier, channel, PopulateActions(actions)); } else { pluginClass.CallStatic("SetNotification", id, delayMs, title, message, message, sound ? 1 : 0, soundName, vibrate ? 1 : 0, lights ? 1 : 0, bigIcon, "notify_icon_small", ToInt(bgColor), bundleIdentifier, channel, PopulateActions(actions)); } }