Пример #1
0
        private static NotyPopLoadTemplate GetNotyPopTemplate(string title, string content, string poptitle, string popcontent, string downloadtitle, string downloadurl)
        {
            NotyPopLoadTemplate notyPopLoadTemplate = new NotyPopLoadTemplate();

            notyPopLoadTemplate.AppId         = Push.APPID;
            notyPopLoadTemplate.AppKey        = Push.APPKEY;
            notyPopLoadTemplate.NotyTitle     = title;
            notyPopLoadTemplate.NotyContent   = content;
            notyPopLoadTemplate.NotyIcon      = "";
            notyPopLoadTemplate.LogoURL       = Push.LOGOURL;
            notyPopLoadTemplate.PopTitle      = poptitle;
            notyPopLoadTemplate.PopContent    = popcontent;
            notyPopLoadTemplate.PopImage      = "";
            notyPopLoadTemplate.PopButton1    = "下载";
            notyPopLoadTemplate.PopButton2    = "取消";
            notyPopLoadTemplate.LoadTitle     = downloadtitle;
            notyPopLoadTemplate.LoadIcon      = Push.LOGOURL;
            notyPopLoadTemplate.LoadUrl       = downloadurl;
            notyPopLoadTemplate.IsActived     = true;
            notyPopLoadTemplate.IsAutoInstall = true;
            notyPopLoadTemplate.IsBelled      = true;
            notyPopLoadTemplate.IsVibrationed = true;
            notyPopLoadTemplate.IsCleared     = true;
            return(notyPopLoadTemplate);
        }
Пример #2
0
        /// <summary>
        /// 通知弹框下载模板
        /// </summary>
        /// <returns></returns>
        private static NotyPopLoadTemplate NotyPopLoadTemplateDemo()
        {
            NotyPopLoadTemplate template = new NotyPopLoadTemplate();

            template.AppId       = APPID;
            template.AppKey      = APPKEY;
            template.NotyTitle   = "请填写通知标题";                                                                  //通知栏标题
            template.NotyContent = "请填写通知内容";                                                                  //通知栏内容
            template.NotyIcon    = "icon.png";                                                                 //通知栏显示本地图片
            template.LogoURL     = "http://www-igexin.qiniudn.com/wp-content/uploads/2013/08/logo_getui1.png"; //通知栏显示网络图标

            template.PopTitle   = "弹框标题";                                                                      //弹框显示标题
            template.PopContent = "弹框内容";                                                                      //弹框显示内容
            template.PopImage   = "";                                                                          //弹框显示图片
            template.PopButton1 = "下载";                                                                        //弹框左边按钮显示文本
            template.PopButton2 = "取消";                                                                        //弹框右边按钮显示文本

            template.LoadTitle = "下载标题";                                                                       //通知栏显示下载标题
            template.LoadIcon  = "file://push.png";                                                            //通知栏显示下载图标,可为空
            template.LoadUrl   = "http://www.appchina.com/market/d/425201/cop.baidu_0/com.gexin.im.apk";       //下载地址,不可为空

            template.IsActived     = true;                                                                     //应用安装完成后,是否自动启动
            template.IsAutoInstall = true;                                                                     //下载应用完成后,是否弹出安装界面,true:弹出安装界面,false:手动点击弹出安装界面

            template.IsBelled      = true;                                                                     //接收到消息是否响铃,true:响铃 false:不响铃
            template.IsVibrationed = true;                                                                     //接收到消息是否震动,true:震动 false:不震动
            template.IsCleared     = true;                                                                     //接收到消息是否可清除,true:可清除 false:不可清除
            return(template);
        }
Пример #3
0
        /*
         *
         * 所有推送接口均支持四个消息模板,依次为透传模板,通知透传模板,通知链接模板,通知弹框下载模板
         * 注:IOS离线推送需通过APN进行转发,需填写pushInfo字段,目前仅不支持通知弹框下载功能
         *
         */

        /// <summary>
        /// 通知弹框下载模板动作内容,常用于下载apk更新软件等
        /// </summary>
        /// <param name="notyTitle">通知栏标题</param>
        /// <param name="notyContent">通知栏内容</param>
        /// <param name="notyIcon">通知栏显示本地图片</param>
        /// <param name="logoUrl">通知栏显示网络图标</param>
        /// <param name="popTitle">弹框显示标题</param>
        /// <param name="popContent">弹框显示内容</param>
        /// <param name="popImage">弹框显示图片</param>
        /// <param name="popButton1">弹框左边按钮显示文本</param>
        /// <param name="popButton2">弹框右边按钮显示文本</param>
        /// <param name="loadTitle">通知栏显示下载标题</param>
        /// <param name="loadIcon">通知栏显示下载图标,可为空</param>
        /// <param name="loadUrl">下载地址,不可为空</param>
        public NotyPopLoadTemplate NotyPopLoadTemplate(string notyTitle, string notyContent, string notyIcon, string logoUrl, string popTitle, string popContent, string popImage, string popButton1, string popButton2, string loadTitle, string loadIcon, string loadUrl)
        {
            NotyPopLoadTemplate template = new NotyPopLoadTemplate();

            template.AppId       = APPID;
            template.AppKey      = APPKEY;
            template.NotyTitle   = notyTitle;   //通知栏标题
            template.NotyContent = notyContent; //通知栏内容
            template.NotyIcon    = notyIcon;    //通知栏显示本地图片,如icon.png
            template.LogoURL     = logoUrl;     //通知栏显示网络图标,如http://www-igexin.qiniudn.com/wp-content/uploads/2013/08/logo_getui1.png

            template.PopTitle   = popTitle;     //弹框显示标题
            template.PopContent = popContent;   //弹框显示内容
            template.PopImage   = popImage;     //弹框显示图片
            template.PopButton1 = popButton1;   //弹框左边按钮显示文本
            template.PopButton2 = popButton2;   //弹框右边按钮显示文本

            template.LoadTitle = loadTitle;     //通知栏显示下载标题
            template.LoadIcon  = loadIcon;      //通知栏显示下载图标,可为空,如file://push.png
            template.LoadUrl   = loadUrl;       //下载地址,不可为空,http://www.appchina.com/market/d/425201/cop.baidu_0/com.gexin.im.apk

            template.IsActived     = true;      //应用安装完成后,是否自动启动
            template.IsAutoInstall = true;      //下载应用完成后,是否弹出安装界面,true:弹出安装界面,false:手动点击弹出安装界面
            template.IsBelled      = true;      //接收到消息是否响铃,true:响铃 false:不响铃
            template.IsVibrationed = true;      //接收到消息是否震动,true:震动 false:不震动
            template.IsCleared     = true;      //接收到消息是否可清除,true:可清除 false:不可清除
            return(template);
        }
Пример #4
0
        //PushMessageToList接口测试代码
        public static void PushMessageToList(int PaltForm, string clientId, string NoticeTitle, string NoticeContent, string custom_content)
        {
            IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET);

            ListMessage message = new ListMessage();

            /*消息模版:
             *   1.TransmissionTemplate:透传功能模板
             *   2.LinkTemplate:通知打开链接功能模板
             *   3.NotificationTemplate:通知透传功能模板
             *   4.NotyPopLoadTemplate:通知弹框下载功能模板
             */

            //TransmissionTemplate template =  TransmissionTemplateDemo();
            //NotificationTemplate template =  NotificationTemplateDemo();
            //LinkTemplate template = LinkTemplateDemo();
            NotyPopLoadTemplate template = NotyPopLoadTemplateDemo();

            message.IsOffline         = false;                 // 用户当前不在线时,是否离线存储,可选
            message.OfflineExpireTime = 1000 * 3600 * 12;      // 离线有效时间,单位为毫秒,可选
            message.Data = template;

            //设置接收者
            List <com.igetui.api.openservice.igetui.Target> targetList = new List <com.igetui.api.openservice.igetui.Target>();

            com.igetui.api.openservice.igetui.Target target1 = new com.igetui.api.openservice.igetui.Target();
            target1.appId    = APPID;
            target1.clientId = CLIENTID;

            // 如需要,可以设置多个接收者
            //com.igetui.api.openservice.igetui.Target target2 = new com.igetui.api.openservice.igetui.Target();
            //target2.AppId = APPID;
            //target2.ClientId = "ddf730f6cabfa02ebabf06e0c7fc8da0";

            targetList.Add(target1);
            //targetList.Add(target2);

            String contentId  = push.getContentId(message);
            String pushResult = push.pushMessageToList(contentId, targetList);

            System.Console.WriteLine("-----------------------------------------------");
            System.Console.WriteLine("服务端返回结果:" + pushResult);
        }
Пример #5
0
        /// <summary>
        /// 通知弹框下载模板
        /// </summary>
        /// <param name="notyTitle">通知栏标题</param>
        /// <param name="notyContent">通知栏内容</param>
        /// <param name="notyIcon">通知栏显示本地图片</param>
        /// <param name="logoUrl">通知栏显示网络图标</param>
        /// <param name="popTitle">弹框显示标题</param>
        /// <param name="popContent">弹框显示内容</param>
        /// <param name="popImage">弹框显示图片</param>
        /// <param name="popButton1">弹框左边按钮显示文本</param>
        /// <param name="popButton2">弹框右边按钮显示文本</param>
        /// <param name="loadTitle">通知栏显示下载标题</param>
        /// <param name="loadIcon">通知栏显示下载图标,可为空</param>
        /// <param name="loadUrl">下载地址,不可为空</param>
        public string PushTemplate(int pushType, string notyTitle, string notyContent, string notyIcon, string logoUrl, string popTitle, string popContent, string popImage, string popButton1, string popButton2, string loadTitle, string loadIcon, string loadUrl)
        {
            NotyPopLoadTemplate template = NotyPopLoadTemplate(notyTitle, notyContent, notyIcon, logoUrl, popTitle, popContent, popImage, popButton1, popButton2, loadTitle, loadIcon, loadUrl);

            switch (pushType)
            {
            case Enum_Push.Single:
                return(PushSingle(template));

            case Enum_Push.Multiple:
                return(PushMultiple(template));

            case Enum_Push.All:
                return(PushAll(template));

            default:
                return("false");
            }
        }
Пример #6
0
        /// <summary>
        /// 通知栏弹框下载模板
        /// </summary>
        /// <param name="NotyTitle">通知栏标题</param>
        /// <param name="NotyContent">通知栏内容</param>
        /// <param name="NotyIcon">通知栏显示本地图片</param>
        /// <param name="LogoURL">通知栏显示网络图标</param>
        /// <param name="PopTitle">弹框显示标题</param>
        /// <param name="PopContent">弹框显示内容</param>
        /// <param name="PopImage">弹框显示图片</param>
        /// <param name="PopButton1">弹框左边按钮显示文本</param>
        /// <param name="PopButton2">弹框右边按钮显示文本</param>
        /// <param name="LoadTitle">通知栏显示下载标题</param>
        /// <param name="LoadIcon">通知栏显示下载图标,可为空</param>
        /// <param name="LoadUrl">下载地址,不可为空</param>
        /// <param name="IsActived">下载应用完成后,是否弹出安装界面,true:弹出安装界面,false:手动点击弹出安装界面</param>
        /// <param name="IsAutoInstall">应用安装完成后,是否自动启动</param>
        /// <param name="IsBelled">接收到消息是否响铃,true:响铃 false:不响铃</param>
        /// <param name="IsVibrationed">接收到消息是否震动,true:震动 false:不震动</param>
        /// <param name="IsCleared">接收到消息是否可清除,true:可清除 false:不可清除 </param>
        /// <returns></returns>
        public static NotyPopLoadTemplate NotyPopLoadTemplate(string NotyTitle, string NotyContent, string NotyIcon, string LogoURL, string PopTitle, string PopContent, string PopImage, string PopButton1, string PopButton2, string LoadTitle, string LoadIcon, string LoadUrl, bool IsActived, bool IsAutoInstall, bool IsBelled, bool IsVibrationed, bool IsCleared)
        {
            NotyPopLoadTemplate template = new NotyPopLoadTemplate();

            template.AppId  = APPID;
            template.AppKey = APPKEY;
            //通知栏标题
            template.NotyTitle = NotyTitle;
            //通知栏内容
            template.NotyContent = NotyContent;
            //通知栏显示本地图片
            template.NotyIcon = NotyIcon;
            //通知栏显示网络图标
            template.LogoURL = LogoURL;
            //弹框显示标题
            template.PopTitle = PopTitle;
            //弹框显示内容
            template.PopContent = PopContent;
            //弹框显示图片
            template.PopImage = PopImage;
            //弹框左边按钮显示文本
            template.PopButton1 = PopButton1;
            //弹框右边按钮显示文本
            template.PopButton2 = PopButton2;
            //通知栏显示下载标题
            template.LoadTitle = LoadTitle;
            //通知栏显示下载图标,可为空
            template.LoadIcon = LoadIcon;
            //下载地址,不可为空
            template.LoadUrl = LoadUrl;
            //应用安装完成后,是否自动启动
            template.IsActived = IsActived;
            //下载应用完成后,是否弹出安装界面,true:弹出安装界面,false:手动点击弹出安装界面
            template.IsAutoInstall = IsAutoInstall;
            //接收到消息是否响铃,true:响铃 false:不响铃
            template.IsBelled = IsBelled;
            //接收到消息是否震动,true:震动 false:不震动
            template.IsVibrationed = IsVibrationed;
            //接收到消息是否可清除,true:可清除 false:不可清除
            template.IsCleared = IsCleared;
            return(template);
        }
Пример #7
0
        public static bool SendNotyPopMsgToList(List <string> clientidlist, string title, string content, string poptitle, string popcontent, string downloadtitle, string downloadurl)
        {
            NotyPopLoadTemplate notyPopTemplate = Push.GetNotyPopTemplate(title, content, poptitle, popcontent, downloadtitle, downloadurl);

            return(Push.PushMsgToList(clientidlist, notyPopTemplate));
        }
Пример #8
0
        public static bool SendNotyPopMsgToSingle(string clientid, string title, string content, string poptitle, string popcontent, string downloadtitle, string downloadurl)
        {
            NotyPopLoadTemplate notyPopTemplate = Push.GetNotyPopTemplate(title, content, poptitle, popcontent, downloadtitle, downloadurl);

            return(Push.PushMsgToSingleDevice(clientid, notyPopTemplate));
        }