예제 #1
0
        /// <summary>
        /// 添加前台可显示的本地推送
        /// </summary>
        /// <param name="key">设置通知参数时userInfo指定的key</param>
        public static void AddLocalNotificationAtFront(MSDKLocalNotification localNotification)
        {
            try {
                string localNotificationJson = MiniJSON.Json.Serialize(localNotification);
                MSDKLog.Log("AddLocalNotificationAtFront channel=" + "" + " localNotificationJso= " + localNotificationJson);
#if UNITY_EDITOR
#else
                addLocalNotificationAtFrontAdapter("", localNotificationJson);
#endif
            } catch (Exception ex) {
                MSDKLog.LogError("AddLocalNotificationAtFront with unknown error = \n" + ex.Message + "\n" + ex.StackTrace);
            }
        }
예제 #2
0
        /// <summary>
        /// 新增本地推送
        /// 本地通知的数量是有限制的,最近的本地通知最多只能有64个,超过将被系统忽略
        /// </summary>
        /// <param name="channel">渠道信息,比如 XG,Firebase</param>
        /// <param name="localNotification">本地推送消息结构体</param>
        public static void AddLocalNotification(string channel, MSDKLocalNotification localNotification)
        {
            try
            {
                var localNotificationJson = localNotification.ToString();
                MSDKLog.Log("AddLocalNotification channel=" + channel + " localNotificationJson=" + localNotificationJson);
#if UNITY_EDITOR
#else
                addLocalNotificationAdapter(channel, localNotificationJson);
#endif
            }
            catch (Exception ex)
            {
                MSDKLog.LogError("AddLocalNotification with unknown error = \n" + ex.Message + "\n" + ex.StackTrace);
            }
        }