cn.jpush.api.JPushClient.SendPush C# (CSharp) Method

SendPush() public method

向某个设备或者某设别列表推送一条通知,或者消息
包含http错误码:如401,404等,错误信息,JPush returen code和JPush returen mssage 包含错误的信息
public SendPush ( PushPayload payload ) : MessageResult
payload cn.jpush.api.push.mode.PushPayload
return cn.jpush.api.push.MessageResult
        public MessageResult SendPush(PushPayload payload)
        {
            Preconditions.checkArgument(payload!=null, "pushPayload should not be empty");
            return _pushClient.sendPush(payload);
        }

Same methods

JPushClient::SendPush ( string payloadString ) : MessageResult

Usage Example

Example #1
0
        protected void btn_Send_Click(object sender, EventArgs e)
        {
            JPushClient pushClient = new JPushClient(apikKey, secretKey);
            try
            {
                Message msg = new Message(txtContent.Value, txtTitle.Value, "");

                //广播
                if (this.rbBrandCast.Checked)
                {
                    pushClient.SendPush(PushPayload.SendAndroidAlertPushToAll(msg));
                }
                //批量发送
                else if (this.rbBatch.Checked)
                {
                    string[] paramsId = new string[] { "0304819befc", "021032" };
                    pushClient.SendPush(PushPayload.SendAndroidAlertBatchPush(msg, paramsId));
                }
                //单独设备发送
                else if (rbSingleDevice.Checked)
                {
                    string registerId = "0304819befc";
                    pushClient.SendPush(PushPayload.SendAndroidAlertSinglePush(msg, registerId));

                }
            }
            catch (Exception msg)
            {
                txtResponse.Value = msg.Message;
            }
        }
All Usage Examples Of cn.jpush.api.JPushClient::SendPush