示例#1
0
        /// <summary>
        /// 透传模板动作内容
        /// </summary>
        /// <param name="transContent">透传内容</param>
        /// <param name="beginTM">客户端展示开始时间</param>
        /// <param name="endTM">客户端展示结束时间</param>
        /// <returns></returns>
        public TransmissionTemplate TransmissionTemplate(string transContent, string beginTM, string endTM)
        {
            TransmissionTemplate template = new TransmissionTemplate();

            template.AppId               = APPID;
            template.AppKey              = APPKEY;
            template.TransmissionType    = "1";          //应用启动类型,1:强制应用启动 2:等待应用启动
            template.TransmissionContent = transContent; //透传内容
            //iOS推送需要的pushInfo字段
            //template.setPushInfo(actionLocKey, badge, message, sound, payload, locKey, locArgs, launchImage);
            template.setPushInfo("1", 4, "2", "", "", "", "", "");
            //设置客户端展示时间
            String begin = beginTM;
            String end   = endTM;

            template.setDuration(begin, end);
            return(template);
        }
示例#2
0
        //透传模板动作内容
        public TransmissionTemplate TransmissionTemplateDemo()
        {
            TransmissionTemplate template = new TransmissionTemplate();

            template.AppId  = APPID;
            template.AppKey = APPKEY;
            //应用启动类型,1:强制应用启动 2:等待应用启动
            template.TransmissionType = "1";
            //透传内容
            template.TransmissionContent = "派工信息";
            //设置通知定时展示时间,结束时间与开始时间相差需大于6分钟,消息推送后,客户端将在指定时间差内展示消息(误差6分钟)
            String begin = "2015-03-06 14:36:10";
            String end   = "2017-03-06 14:46:20";

            template.setDuration(begin, end);

            return(template);
        }
示例#3
0
        /// <summary>
        /// 透传模板动作内容
        /// </summary>
        /// <param name="TransmissionType">应用启动类型,1:强制应用启动 2:等待应用启动</param>
        /// <param name="TransmissionContent">透传内容</param>
        /// <param name="beginTime">设置通知定时展示时间,结束时间与开始时间相差需大于6分钟,消息推送后,客户端将在指定时间差内展示消息(误差6分钟)</param>
        /// <param name="endTime">设置通知定时展示时间,结束时间与开始时间相差需大于6分钟,消息推送后,客户端将在指定时间差内展示消息(误差6分钟)</param>
        /// <returns></returns>
        public static TransmissionTemplate TransmissionTemplate(string TransmissionType, string Transmissiontitle, string TransmissionContent, string beginTime, string endTime)
        {
            TransmissionTemplate template = new TransmissionTemplate();

            template.AppId  = APPID;
            template.AppKey = APPKEY;
            //应用启动类型,1:强制应用启动 2:等待应用启动
            template.TransmissionType = TransmissionType;
            //透传内容
            template.TransmissionContent = TransmissionContent;

            APNPayload         apnpayload = new APNPayload();
            DictionaryAlertMsg alertMsg   = new DictionaryAlertMsg();

            alertMsg.Body         = string.Empty;
            alertMsg.ActionLocKey = TransmissionContent;
            alertMsg.LocKey       = Transmissiontitle;
            //alertMsg.addLocArg("LocArg");
            alertMsg.addLocArg(Transmissiontitle);
            alertMsg.LaunchImage = "";
            ////IOS8.2支持字段
            alertMsg.Title       = "您收到了一条消息";
            alertMsg.TitleLocKey = Transmissiontitle;
            //alertMsg.addTitleLocArg("TitleLocArg");
            alertMsg.addTitleLocArg(Transmissiontitle);
            apnpayload.AlertMsg         = alertMsg;
            apnpayload.Badge            = 1;
            apnpayload.ContentAvailable = 1;
            ////apnpayload.Category = "";
            //apnpayload.Sound = "test1.wav";
            apnpayload.addCustomMsg("payload", "payload");
            template.setAPNInfo(apnpayload);
            //设置通知定时展示时间,结束时间与开始时间相差需大于6分钟,消息推送后,客户端将在指定时间差内展示消息(误差6分钟)
            String begin = beginTime;
            String end   = endTime;

            if (!string.IsNullOrEmpty(begin) && !string.IsNullOrEmpty(end))
            {
                template.setDuration(begin, end);
            }
            return(template);
        }