public void JackTestToken() { string result = null; int messageIndex = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds); var appID = "4c1723a2b00a8"; var accessID = 2100316995; var secretKey = "ed911cc8d3e9d1472c41968fea86c99c"; var token = "931464a16ad1144a4c9c8cc5ca58548ed365e24f";//小米 token = "2de820afa4853e70c735c3e1325a07b430110375";//华为 //token = "094983a3ee98a0f7e27355326b83174aad9f3254";//vivo //token = "205445ada5b50439419190658ea650e0f8895543";//魅族 Message message = new Message(); message.setType("notify"); message.setStyle(new Style(0, 1, 1, 1, messageIndex)); message.setTitle("title" + messageIndex); message.setSendTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); message.setContent("content" + messageIndex); message.setCustom(new Dictionary<string, object>() { { "custom_content",new Dictionary<string, object>() { { "title","title" + messageIndex}, { "body","content" + messageIndex}, { "custom","abc"}, }} }); //必须把action设置为null,否则小米无法接收点击事件 message.setAction(null); XingeApp.XingeApp xinge = new XingeApp.XingeApp(appID, accessID, secretKey); string ret = xinge.PushSingleDevice(token, message); }
/// <summery>推送普通消息给全部的设备,限iOS系统使用 /// <param name = "appID"> V3版本接口中对应用的标识 </param> /// <param name = "accessID"> V2版本接口中系统自动生成的标识 </param> /// <param name = "secretKey"> 用于API调用的秘钥 </param> /// <param name = "content"> 消息内容 </param> /// <param name = "environment"> 指定推送环境 </param> /// <returns> 推送结果描述 </returns> /// </summery> public static string pushAlliOS(string appID, long accessID, string secretKey, string content, PushEnvironmentofiOS environment) { MessageiOS message = new MessageiOS(); message.setAlert(content); XingeApp xinge = new XingeApp(appID, accessID, secretKey); string ret = xinge.PushAllDevice(message, environment); return(ret); }
/// <summery>推送普通消息给全部的设备,限Android系统使用 /// <param name = "appID"> V3版本接口中对应用的标识 </param> /// <param name = "accessID"> V2版本接口中系统自动生成的标识 </param> /// <param name = "secretKey"> 用于API调用的秘钥 </param> /// <param name = "title"> 消息标题 </param> /// <param name = "content"> 消息内容 </param> /// <returns> 推送结果描述 </returns> /// </summery> public static string pushAllAndroid(string appID, long accessID, string secretKey, string title, string content) { Message message = new Message(); message.setType(XGPushConstants.OrdinaryMessage); message.setTitle(title); message.setContent(content); XingeApp xinge = new XingeApp(appID, accessID, secretKey); string ret = xinge.PushAllDevice(message); return(ret); }
//推送给全部的设备,限IOS系统使用 public static string pushAllIos(long accessId, string secretKey, string content, int env) { MessageIOS message = new MessageIOS(); message.setAlert(content); message.setBadge(1); message.setSound("beep.wav"); XingeApp xinge = new XingeApp(accessId, secretKey); string ret = xinge.PushAllDevice(message, env); return(ret); }
//推送给全部的设备,限Android系统使用 public static string pushAllAndroid(long accessId, string secretKey, string title, string content) { Message message = new Message(); message.setType(Message.TYPE_NOTIFICATION); message.setTitle(title); message.setContent(content); XingeApp xinge = new XingeApp(accessId, secretKey); string ret = xinge.PushAllDevice(message); return(ret); }
/// <summery>推送普通消息给绑定标签的设备,限iOS系统使用 /// <param name = "appID"> V3版本接口中对应用的标识 </param> /// <param name = "accessID"> V2版本接口中系统自动生成的标识 </param> /// <param name = "secretKey"> 用于API调用的秘钥 </param> /// <param name = "content"> 消息内容 </param> /// <param name = "tag"> 接收设备标识绑定的标签 </param> /// <param name = "environment"> 指定推送环境 </param> /// <returns> 推送结果描述 </returns> /// </summery> public static string pushTagiOS(string appID, long accessID, string secretKey, string content, string tag, PushEnvironmentofiOS environment) { MessageiOS message = new MessageiOS(); message.setAlert(content); XingeApp xinge = new XingeApp(appID, accessID, secretKey); List <string> tagList = new List <string>(); tagList.Add(tag); string ret = xinge.PushTags(tagList, "OR", message, environment); return(ret); }
/// <summery>//推送普通消息给绑定标签的设备,限Android系统使用 /// <param name = "appID"> V3版本接口中对应用的标识 </param> /// <param name = "accessID"> V2版本接口中系统自动生成的标识 </param> /// <param name = "secretKey"> 用于API调用的秘钥 </param> /// <param name = "title"> 消息标题 </param> /// <param name = "content"> 消息内容 </param> /// <param name = "tag"> 接收设备标识绑定的标签 </param> /// <returns> 推送结果描述 </returns> /// </summery> public static string pushTagAndroid(string appID, long accessID, string secretKey, string title, string content, string tag) { Message message = new Message(); message.setType(XGPushConstants.OrdinaryMessage); message.setTitle(title); message.setContent(content); XingeApp xinge = new XingeApp(appID, accessID, secretKey); List <string> tagList = new List <string>(); tagList.Add(tag); string ret = xinge.PushTags(tagList, "OR", message); return(ret); }
//推送给绑定标签的设备,限IOS系统使用 public static string pushTagIos(long accessId, string secretKey, string content, string tag, int env) { MessageIOS message = new MessageIOS(); message.setAlert(content); message.setBadge(1); message.setSound("beep.wav"); XingeApp xinge = new XingeApp(accessId, secretKey); List <string> tagList = new List <string>(); tagList.Add(tag); string ret = xinge.PushTags(tagList, "OR", message, env); return(ret); }
//推送给绑定标签的设备,限Android系统使用 public static string pushTagAndroid(long accessId, string secretKey, string title, string content, string tag) { Message message = new Message(); message.setType(Message.TYPE_NOTIFICATION); message.setTitle(title); message.setContent(content); XingeApp xinge = new XingeApp(accessId, secretKey); List <string> tagList = new List <string>(); tagList.Add(tag); string ret = xinge.PushTags(tagList, "OR", message); return(ret); }