百度云推送

展开

 

调用方法

/// <summary>
        /// 推送通知给所有人
        /// </summary>
        public static JsonResponse PushAllNotification(DeviceType deviceType, PushMessage msg)
        {
            var req = new PushMsgRequest();

            req.DeviceType = (uint)deviceType;
            req.PushType = 3;

            req.MessageType = 1;
            req.MsgKeys = msg.Key;
            req.Messages = GetNotification(deviceType, msg);
            if (deviceType == DeviceType.iOS) req.DeployStatus = DEPLOY_STATUS; //IOS需指定部署状态
            var res = PushClient.Execute(req);


            JsonResponse jsonResponse = new JsonResponse();
            if (res.IsError == false)
            {
                jsonResponse.status = 0;
                jsonResponse.message = "成功";
                jsonResponse.data = res.Body;
            }
            else
            {
                jsonResponse.status = 1;
                jsonResponse.message = "失败";
                jsonResponse.data = res.Body;
            }

            return jsonResponse;
            //return res.IsError ? 0 : res.ResponseParams.SuccessAmount;
        }

 

参考:https://baidupush.codeplex.com/

你可能感兴趣的:(百度)