/// <summary> /// 构造函数 /// </summary> public AndroidMessage() { //设备锁定为android this.MessageParameters.Add("device_type", ((uint)DeviceTypes.Android).ToString()); // BaiduPushNotification msg = new BaiduPushNotification(); this.MessageParameters.Add("messages", msg); }
/// <summary> /// 创建单播的消息(消息类型=通知)推送请求 /// </summary> /// <param name="pBaiduUserID"></param> /// <param name="pBaiduChannelID"></param> /// <param name="pMessageTitle"></param> /// <param name="pMessageDescription"></param> /// <returns></returns> public static PushMsgRequest CreateUnicastNotificationRequest(string pBaiduUserID , string pBaiduChannelID , string pMessageTitle , string pMessageDescription , PushTypes pushType = PushTypes.Unicast) { BaiduPushNotification msg = new BaiduPushNotification(); msg.Title = pMessageTitle; msg.Description = pMessageDescription; msg.OpenType = 2; msg.NotificationBuilderID = 0; msg.NotificationBasicStyle = 4; return(PushMsgRequestBuilder.CreateUnicastNotificationRequest(pBaiduUserID, pBaiduChannelID, null, msg, null, pushType)); }
/// <summary> /// 创建单播的消息(消息类型=通知)推送请求 /// </summary> /// <param name="pBaiduUserID"></param> /// <param name="pBaiduChannelID"></param> /// <param name="pDeviceType"></param> /// <param name="pMessage"></param> /// <param name="pMessageKey"></param> /// <returns></returns> public static PushMsgRequest CreateUnicastNotificationRequest(string pBaiduUserID , string pBaiduChannelID , DeviceTypes?pDeviceType , BaiduPushNotification pMessage , string pMessageKey , PushTypes pushType = PushTypes.Unicast) { PushMsgRequest req = new PushMsgRequest(); req.MessageType = MessageTypes.Notification; req.PushType = pushType; if (!string.IsNullOrEmpty(pBaiduUserID)) { req.BaiduUserID = pBaiduUserID; } req.BaiduChannelID = pBaiduChannelID; req.DeviceType = pDeviceType; req.Notification = pMessage; if (!string.IsNullOrWhiteSpace(pMessageKey)) { req.BaiduMessageKey = pMessageKey; } return(req); }
/// <summary> /// 创建单播的消息(消息类型=通知)推送请求 /// </summary> /// <param name="pBaiduUserID"></param> /// <param name="pBaiduChannelID"></param> /// <param name="pMessage"></param> /// <returns></returns> public static PushMsgRequest CreateUnicastNotificationRequest(string pBaiduUserID , string pBaiduChannelID , BaiduPushNotification pMessage) { return(PushMsgRequestBuilder.CreateUnicastNotificationRequest(pBaiduUserID, pBaiduChannelID, null, pMessage, null)); }