コード例 #1
0
        public bool PushByKey(string pushKey, string tiker, string title, string text, Dictionary <string, object> objs)
        {
            UmengData data = GetPushData(tiker, tiker, text, objs);

            data.SetAlias(pushKey);

            return(Push("http://msg.umeng.com/api/send", data));
        }
コード例 #2
0
        public bool PushAll(string tiker, string title, string text, Dictionary <string, object> objs)
        {
            UmengData data = GetPushData(tiker, tiker, text, objs);

            data.type = CastType.broadcast;

            return(Push("http://msg.umeng.com/api/send", data));
        }
コード例 #3
0
        private UmengData GetPushData(string tiker, string title, string text, Dictionary <string, object> objs)
        {
            UmengData data = new UmengData();

            data.payload.SetTicker(tiker);
            data.payload.SetTitle(title);
            data.payload.SetText(text);
            data.extra = objs;
            return(data);
        }
コード例 #4
0
        private bool Push(string url, UmengData data)
        {
            string body = data.ToJsonString();
            var    sign = GetSign(url, body);

            var pushUrl = string.Format("{0}?sign={1}", url, sign);

            WebClient client = new WebClient();
            var       rep    = client.UploadString(pushUrl, body);

            _logger.Info(rep);
            return(true);
        }