コード例 #1
0
    // 重要度によって通知間隔を全てセット、
    private void PushNoticeSet(string contnt, int priority)
    {
        DateTime nowTime       = DateTime.Now;
        DateTime todayMidnight = new DateTime(nowTime.Year, nowTime.Month, nowTime.Day, 07, 00, 00);
        TimeSpan ts            = todayMidnight - nowTime;
        int      totalMSecond  = ((ts.Hours * 3600) + ts.Seconds) * 1000; // 真夜中までのミリ秒の差

        int moreInportantSecond = 2;
        int inportantSecond     = 10;

        if (priority == 100)
        {
            int span = totalMSecond / (moreInportantSecond * 1000);
            for (int i = 0; i < span - 1; i++)
            {
                LocalPush.AddSchedule("NoticeChat", contnt, badgeCount, i * moreInportantSecond + 1, "null");
                badgeCount++;
            }
        }
        else if (priority == 10)
        {
            int span = totalMSecond / (inportantSecond * 1000);
            for (int i = 0; i < span - 1; i++)
            {
                LocalPush.AddSchedule("NoticeChat", contnt, badgeCount, i * inportantSecond + 1, "null");
                badgeCount++;
            }
        }
    }
コード例 #2
0
    private void Awake()
    {
        Ins = this;
        GameObject.DontDestroyOnLoad(this);
#if UNITY_ANDROID
        SetLocalNotification(new AndriodPush());
#elif UNITY_IOS
        SetLocalNotification(new IphonePush());
#endif
        localNotify?.CleanNotification();
    }
コード例 #3
0
 // バックグラウンド時の動作
 private void OnApplicationPause(bool pauseStatus)
 {
     if (pauseStatus)
     {
         // 重要メッセージ一覧を取得
         getDataFromKeys = messageManager.getImportantMessages().result;
         Debug.Log("重要メッセージ数:" + getDataFromKeys.Length);
         for (int i = 0; i < getDataFromKeys.Length; i++)
         {
             // 関数呼び出し
             PushNoticeSet(getDataFromKeys[i].content, getDataFromKeys[i].priority);
         }
         Debug.Log("設定完了!!!");
     }
     else
     {
         LocalPush.AllClear();
     }
 }