Ejemplo n.º 1
0
 private void OnApplicationFocus(bool focus)
 {
     if (focus == false)
     {
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(6, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.DailyReward), new TimeSpan(24, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(48, 0, 0), "icon_0", "icon_1", "from notification");
         GleyNotifications.SendNotification($"Dices {_dice}", GetLocalizedText(PushTextType.Basic), new TimeSpan(72, 0, 0), "icon_0", "icon_1", "from notification");
     }
 }
    /// <summary>
    /// Associated with UI button
    /// </summary>
    public void SendNotification()
    {
        int minutes = 0;

        int.TryParse(input.text, out minutes);
        if (minutes > 0)
        {
            GleyNotifications.SendNotification("Game Title", "Notification body", new System.TimeSpan(0, minutes, 0), null, null, "Opened from Gley Notification");
        }
    }
 /// <summary>
 /// The best way to schedule notifications is from OnApplicationFocus method
 /// when this is called user left your app
 /// when you trigger notifications when user is still in app, maybe your notification will be delivered when user is still inside the app and that is not good practice
 /// </summary>
 /// <param name="focus"></param>
 private void OnApplicationFocus(bool focus)
 {
     if (focus == false)
     {
         //if user left your app schedule all your notifications
         GleyNotifications.SendNotification("Game Title", "App was minimized", new System.TimeSpan(0, 1, 0), null, null, "Opened from Gley Minimized Notification");
     }
     else
     {
         //call initialize when user returns to your app to cancel all pending notifications
         GleyNotifications.Initialize();
     }
 }
Ejemplo n.º 4
0
    public void OnClickSetAlarmButton()
    {
        GleyNotifications.Initialize(false);

        int tempHours = selectedTime.hours + (selectedTime.am_pm.Equals("AM") ? 0 : 12);

        DateTime current  = DateTime.Now;
        DateTime selected = new DateTime(selectedDate.year, selectedDate.month + 1, selectedDate.day, tempHours, selectedTime.minutes, 0);

        TimeSpan reqTime = selected.Subtract(current);

        Debug.Log("Difference: " + (reqTime.Hours + reqTime.Days * 24) + ":" + reqTime.Minutes + ":" + reqTime.Seconds);

        Hou = reqTime.Hours + reqTime.Days * 24;
        Mi  = reqTime.Minutes;
        Se  = reqTime.Seconds;

        if (Hou < 0 || Mi < 0 || Se < 0)
        {
            PopupManager.Instance.messagePopup.Show("Invalid Date/Time!", "Please set reminder for future Date/Time only.");
            return;
        }

        AlarmSettings.SetActive(false);
        for (int i = 0; i < AlarmList.Count; i++)
        {
            if (AlarmList[i] == (Hou.ToString() + Mi.ToString() + Se.ToString()))
            {
                PopupManager.Instance.messagePopup.Show("Duplicate Notification", "Notification Already Exits");
                return;
            }
        }
        // var ms = new System.TimeSpan(Hou, Mi, Se);
        var ms = new System.TimeSpan(reqTime.Hours);

        newAlarm = true;
        NotificationManager.Instance.GetAllNotifications();

        GleyNotifications.SendNotification("MeditativeBowls", "Time To Meditate", new System.TimeSpan(Hou, Mi, Se));
        string TotalTimeString = (Hou.ToString() + ":" + Mi.ToString() + ":" + Se.ToString());

        print(TotalTimeString);
        ShowingTile(TotalTimeString, true, Hou, Mi, Se, selected.ToString("dd/MM/yyyy hh:mm tt"));
    }
 // Code implementing the effect of the action
 protected override void OnExecute()
 {
     // Do something with the declared property
     GleyNotifications.SendNotification(gameTitle, notificationBody, new System.TimeSpan(hours, minutes, seconds), smallIconName, largeIconName, "Opened from Notification");
 }
 public override void OnEnter()
 {
     GleyNotifications.SendNotification(gameTitle, notificationBody, new System.TimeSpan(hours, minutes, seconds), smallIcon, largeIcon, "Opened from Notification");
     Finish();
 }