Example #1
0
    public static void NotificationMessage(int push_id, string message, DateTime dst_date, NotificationRepeatInterval repeatInterval)
    {
        if (repeatInterval == NotificationRepeatInterval.None && dst_date <= DateTime.get_Now())
        {
            return;
        }
        long timeInSecond = LocalForAndroidManager.GetTimeInSecond(dst_date);

        if (repeatInterval == NotificationRepeatInterval.None)
        {
            LocalForAndroidManager.SendNotification(push_id, timeInSecond, message, true, true, true, "app_icon", LocalForAndroidManager.NotificationExecuteMode.Inexact);
        }
        else if (repeatInterval == NotificationRepeatInterval.Day)
        {
            LocalForAndroidManager.SendRepeatingNotification(push_id, timeInSecond, 86400L, message, true, true, true, "app_icon");
        }
        else if (repeatInterval == NotificationRepeatInterval.Week)
        {
            LocalForAndroidManager.SendRepeatingNotification(push_id, timeInSecond, 604800L, message, true, true, true, "app_icon");
        }
        else if (repeatInterval == NotificationRepeatInterval.ForTest)
        {
            LocalForAndroidManager.SendRepeatingNotification(push_id, timeInSecond, 5L, message, true, true, true, "app_icon");
        }
        else if (repeatInterval == NotificationRepeatInterval.ForTest2)
        {
            LocalForAndroidManager.SendRepeatingNotification(push_id, timeInSecond, 60L, message, true, true, true, "app_icon");
        }
    }
Example #2
0
    private void NotificationGUI()
    {
        int num = 29;

        num++;
        num++;
        if (GUI.Button(this.GetRect(num), "一次推送"))
        {
            for (int i = 1; i < 100; i++)
            {
                NativeCallManager.NotificationMessage(i, "一次推送" + i, DateTime.get_Now().AddSeconds((double)(i * 60)), NotificationRepeatInterval.None);
            }
        }
        num++;
        if (GUI.Button(this.GetRect(num), "循环推送1"))
        {
            NativeCallManager.NotificationMessage(1000, "循环推送1", DateTime.get_Now().AddSeconds(5.0), NotificationRepeatInterval.ForTest);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "循环推送2"))
        {
            NativeCallManager.NotificationMessage(1000, "循环推送2", DateTime.get_Now().AddSeconds(5.0), NotificationRepeatInterval.ForTest2);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "清空"))
        {
            Debug.LogError("[推送]清理");
            LocalForAndroidManager.CancelNotification(1);
            LocalForAndroidManager.CancelNotification(2);
            LocalForAndroidManager.CancelNotification(3);
        }
    }
Example #3
0
    public static void NotificationMessage(int push_id, string message, int hour, int minute, NotificationRepeatInterval repeatInterval)
    {
        int      year     = DateTime.get_Now().get_Year();
        int      month    = DateTime.get_Now().get_Month();
        int      day      = DateTime.get_Now().get_Day();
        DateTime dst_date = new DateTime(year, month, day, hour, minute, 0);

        LocalForAndroidManager.NotificationMessage(push_id, message, dst_date, repeatInterval);
    }
Example #4
0
    public static void CleanNotification()
    {
        List <int> pushIDs = NativeCallManager.GetPushIDs();

        for (int i = 0; i < pushIDs.get_Count(); i++)
        {
            LocalForAndroidManager.CancelNotification(pushIDs.get_Item(i));
        }
        LocalForAndroidManager.AndroidJC.CallStatic("CancelAll", new object[0]);
    }
 public static void NotificationMessage(int push_id, string message, DateTime newDate, NotificationRepeatInterval repeatInterval)
 {
     NativeCallManager.SavePushIDs(push_id);
     LocalForAndroidManager.NotificationMessage(push_id, message, newDate, repeatInterval);
 }
Example #6
0
 private void Awake()
 {
     LocalForAndroidManager.CleanNotification();
 }