示例#1
0
 public void OneTimeWithActions()
 {
     LocalNotification.Action action1 = new LocalNotification.Action("background", "In Background", this);
     action1.Foreground = false;
     LocalNotification.Action action2 = new LocalNotification.Action("foreground", "In Foreground", this);
     LocalNotification.SendNotification(1, 5000, "Title", "Long message text with actions", new Color32(0xff, 0x44, 0x44, 255), true, true, true, null, "boing", "default", action1, action2);
 }
示例#2
0
 public void OneTimeWithActions()
 {
     LocalNotification.Action action1 = new LocalNotification.Action("background", "хз", this);
     action1.Foreground = false;
     LocalNotification.Action action2 = new LocalNotification.Action("foreground", "приложение?", this);
     LocalNotification.SendNotification(1, 5000, "111", "222", new Color32(0xff, 0x44, 0x44, 255), true, true, true, null, "boing", "default", action1, action2);
 }
示例#3
0
 public void OneTimeWithActions()
 {
     if (PlayerPrefs.GetInt("nofication") == 1)
     {
         PlayerPrefs.SetInt("nofication", 0);
         Stop();
     }
     else
     {
         PlayerPrefs.SetInt("nofication", 1);
         LocalNotification.Action action1 = new LocalNotification.Action("background", "In Background", this);
         action1.Foreground = false;
         LocalNotification.Action action2 = new LocalNotification.Action("foreground", "In Foreground", this);
         LocalNotification.SendNotification(1, 5000, "記得喝水", null, new Color32(0x42, 0xfc, 0x4e, 255), true, true, true, "app_icon", "laugh", "default", action1, action2);
         print("OneTimeWithActions");
     }
 }
示例#4
0
    public void notificationSend()
    {
        string title   = this.title.text;
        string text    = this.description.text;
        string action1 = this.action1.text;
        string action2 = this.action2.text;
        long   delay   = Convert.ToInt64(this.delay.value.ToString()) * 1000;
        string type    = this.type.captionText.text;

        if (title == "")
        {
            title = "test title";
        }

        if (text == "")
        {
            text = "test text";
        }

        if (action1 == "")
        {
            action1 = "action 1";
        }

        if (action2 == "")
        {
            action2 = "action 2";
        }

        switch (type)
        {
        case "Small Icon Notification":
            status.text = "small icon notification set";
            LocalNotification.SendNotification(1, delay, title, text, new Color32(0xff, 0x44, 0x44, 255), sound.isOn, light.isOn, vibration.isOn, "app_icon", icon.captionText.text);
            break;

        case "Big Icon Notification":
            status.text = "Big icon notification set";
            LocalNotification.SendNotification(1, delay, title, text, new Color32(0xff, 0x44, 0x44, 255), sound.isOn, light.isOn, vibration.isOn, "app_icon", icon.captionText.text);
            break;

        case "Action Notification":
            status.text = "Action notification set";
            LocalNotification.Action actionBtn1 = new LocalNotification.Action("action1", action1, this);
            actionBtn1.Foreground = false;
            LocalNotification.Action actionBtn2 = new LocalNotification.Action("action2", action2, this);
            actionBtn2.Foreground = true;
            LocalNotification.SendNotification(1, delay, title, text, new Color32(0xff, 0x44, 0x44, 255), sound.isOn, light.isOn, vibration.isOn, null, icon.captionText.text, "boing", "default", actionBtn1, actionBtn2);
            break;

        case "Repeat":
            status.text = "notification repeat";
            LocalNotification.SendRepeatingNotification(1, delay, 5000, title, text, new Color32(0xff, 0x44, 0x44, 255), sound.isOn, light.isOn, vibration.isOn, null, icon.captionText.text);
            break;

        case "Stop":
            status.text = "notification stop";
            LocalNotification.CancelNotification(1);
            break;

        default:

            break;
        }
    }