public static SimpleResultModel SendToAlias(string msg, string alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); pushPayload.audience = Audience.s_alias(alias.Split(',')); pushPayload.notification = new Notification().setAlert(msg); AndroidNotification androidnotification = new AndroidNotification(); androidnotification.setTitle(TITLE); pushPayload.notification.AndroidNotification = androidnotification; try { var result = client.SendPush(pushPayload); return(new SimpleResultModel() { suc = true, msg = result.msg_id.ToString() }); } catch (APIRequestException e) { return(new SimpleResultModel() { suc = false, msg = "HTTP Status: " + e.Status + ";Error Code: " + e.ErrorCode + ";Error Message: " + e.ErrorMessage }); } catch (APIConnectionException e) { return(new SimpleResultModel() { suc = false, msg = e.message }); } }
private void OrderTimeoutdalRun(object o) { if (_notlogin == null) { _notlogin = new JushNotLoginUserRemind_DAL(); } if (payload == null) { payload = new PushPayload(); } list = _notlogin.NotLoginUserList(); if (list.Count > 0) { List <string> list_users = new List <string>(); list.ForEach(z => list_users.Add(z.Id.ToString().DESEncrypt().StringToMd5().Md532SubString())); //PushPayload payload = new PushPayload(); payload.platform = Platform.all(); payload.audience = Audience.s_alias(list_users.ToArray()); payload.notification = new Notification().setAlert(Config.JushNotLoginUsersRemingMsg).setAndroid(new AndroidNotification().AddExtra("key", Config.JushGoPageLogin)).setIos(new IosNotification().AddExtra("key", Config.JushGoPageLogin)); try { client.SendPush(payload); //记录日志 Config.PushLogAPP("APP长时间未登录推送提醒", list_users.ListToStrings(), Config.JushNotLoginUsersRemingMsg); } catch (Jpush.api.common.APIRequestException ee) { string.Format("\r\n>>>APP长时间未登录推送 推送异常:{0},time:{1}", ee.Message, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") ).WriteLog("ERROR"); } } }
/// <summary> /// 发送消息 /// </summary> /// <param name="msg">消息</param> /// <param name="appKey">appkey</param> /// <param name="masterSecret">主密钥</param> private static void sendAndroidMsgToUsers(PushMsgModel msg, List <PushStaff> userDics, string appKey = "a91410f29fd95fe5800fff9a", string masterSecret = "2bd0c5a1418c05f97ae9048a") { JPushClient client = new JPushClient(appKey, masterSecret); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); foreach (PushStaff item in userDics) { pushPayload.audience = Audience.s_alias(item.UserName); pushPayload.options.time_to_live = 30; if (item.IsPushVoice) { msg.IsPushVoice = true; pushPayload.message = Message.content(SerializationHelper.JsonSerialize(msg)); } else { msg.IsPushVoice = false; pushPayload.message = Message.content(SerializationHelper.JsonSerialize(msg)); } try { var result = client.SendPush(pushPayload); } catch (Exception ex) { } } }
/// <summary> /// 推送消息给别名用户 /// </summary> /// <param name="request">request.PushUsers 以,分隔的多个别名</param> /// <returns></returns> public SnsResponse JpushSendToAlias(SnsRequest request) { PushPayload pushPayload = GetPushPayload(request); var userlist = request.PushUsers.Split(','); //写记录 System.Threading.Tasks.Task.Run(() => { JpushLog _model = new JpushLog(); _model.CreateTime = DateTime.Now; _model.PushId = request.UserId; _model.IsToAll = 0; _model.BePushId = request.PushUsers; _model.PushMsg = request.PushMsg; if (request.PushExtras != null) { _model.ParamString = request.PushExtras.ToString(); } _jpushLog.Insert(_model); }); SnsResponse response = new SnsResponse(); int splitSize = _defaultPushGroupSize; //分割的块大小 Object[] subAry = StringToolsHelper.splitAry(userlist, splitSize); //分割后的子块数组 //分批次推送操作 for (int i = 0; i < subAry.Length; i++) { string[] aryItem = (string[])subAry[i]; var itemStr = string.Join(",", aryItem); try { pushPayload.audience = Audience.s_alias(aryItem); var result = JPushClient.SendPush(pushPayload); response.JpushMsgId = result.msg_id; #region 推送日志 //System.Threading.Tasks.Task.Run(() => //{ // //写日志 // Logger.Error("SnsService———>JpushSendToAlias:" + string.Format("认证用户发送jpush用户ID列表:{0}", itemStr)); //}); #endregion } catch (Exception e) { //Logger.Error("SnsService———>JpushSendToAlias:" + string.Format("认证用户发送jpush:{0},提供的错误信息:{1},id列表:{2}", e.Message, ((cn.jpush.api.common.APIRequestException)e).ErrorMessage, itemStr)); } //休息一秒 避免:Request times of the app_key exceed the limit of current time window System.Threading.Thread.Sleep(100); } return(response); }
//private RequestParamModel<MessageModel> GetRpm(FormCollection context) //{ // var json = context["json"]; // var rpm = new RequestParamModel<MessageModel>(context) { CurrentContext = context, Action = Request["action"] }; // if (!string.IsNullOrEmpty(json)) // { // rpm = JSONhelper.ConvertToObject<RequestParamModel<MessageModel>>(json); // rpm.CurrentContext = context; // } // return rpm; //} //public ActionResult Send() //{ // ViewBag.ToolBar = BuildToolbar(); // return View(); //} //[HttpPost] //[ValidateInput(false)] //public string Send(FormCollection context) //{ // try // { // var ids = Request["ids"]; // var title = Request["title"]; // var content = Request["content"]; // if (string.IsNullOrEmpty(ids)) // { // try // { // List<AppUserModel> list = AppUserDal.Instance.GetWhereStr(" and MASTER_ID IS NOT NULL").ToList(); // foreach (AppUserModel userModel in list) // { // MessageModel messageModel = new MessageModel(); // messageModel.RECEIVE_ID = 0;// PublicMethod.GetDecimal(id); // // model.CONTENT = content; // messageModel.HTML_CONTENT = content; // messageModel.IS_RREAD = 0; // messageModel.SEND_TIME = DateTime.Now; // messageModel.TITLE = title; // messageModel.USER_ID = userModel.FID; // MessageDal.Instance.Insert(messageModel); // } // JPushClient client = new JPushClient(SysVisitor.Instance.PushAppKey, SysVisitor.Instance.PushMasterSecret); // PushPayload pushPayload = new PushPayload(); // pushPayload.platform = Platform.all(); // pushPayload.audience = Audience.all(); // pushPayload.notification = new Notification().setAlert(title); // client.SendPush(pushPayload); // } // catch (Exception ex) // { // LogHelper.WriteLog(string.Format("Error: appKey={0},masterSecret={1},phone={2},title={3},msg={4}", SysVisitor.Instance.PushAppKey, SysVisitor.Instance.PushMasterSecret, "全体", title, ex.Message)); // } // } // else // { // string[] array = ids.Split(','); // foreach (string id in array) // { // MessageModel model = new MessageModel(); // model.RECEIVE_ID = 0;// PublicMethod.GetDecimal(id); // // model.CONTENT = content; // model.HTML_CONTENT = content; // model.IS_RREAD = 0; // model.SEND_TIME = DateTime.Now; // model.TITLE = title; // model.USER_ID = id; // if (MessageDal.Instance.Insert(model) != "") // { // OnPushMessage(id, title); // } // } // } // return JSONhelper.ToJson("发送成功!"); // } // catch (Exception ex) // { // return JSONhelper.ToJson(ex.Message); // } //} private void OnPushMessage(string id, string title) { //DriverModel model = DriverDal.Instance.GetByID(id); AppUserModel model = AppUserDal.Instance.Get(id); if (model != null) { try { JPushClient client = new JPushClient(SysVisitor.Instance.PushAppKey, SysVisitor.Instance.PushMasterSecret); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(model.PHONE); pushPayload.notification = new Notification().setAlert(title); client.SendPush(pushPayload); } catch (Exception ex) { LogHelper.WriteLog(string.Format("Error: appKey={0},masterSecret={1},phone={2},title={3},msg={4}", SysVisitor.Instance.PushAppKey, SysVisitor.Instance.PushMasterSecret, model.PHONE, title, ex.Message)); } } }
/// <summary> /// 发送别名消息 /// </summary> /// <param name="title">标题</param> /// <param name="message">message</param> /// <param name="alias">客户的别名组</param> /// <returns></returns> public MessageResult SendAliaMsg(string title, Message message, string[] alias) { MessageResult result = new MessageResult(); try { JPushClient client = new JPushClient(app_key, master_secret); PushPayload payload = new PushPayload(); Notification not = new Notification(); not.setAlert(title); payload.notification = not; payload.platform = Platform.all(); payload.audience = Audience.s_alias(alias); payload.message = message; result = client.SendPush(payload); } catch (APIRequestException e) { SystemLogsBiz.logv("推送失败APIRequestException", e.ErrorMessage, "类 JpushHelp"); } catch (APIConnectionException e) { SystemLogsBiz.logv("推送失败APIConnectionException", e.Message, "类 JpushHelp"); } return(result); }
/// <summary> /// 发送消息 /// </summary> /// <param name="msg">消息</param> /// <param name="appKey">appkey</param> /// <param name="masterSecret">主密钥</param> private static void sendAndroidMsgToUsers(PushMsgModel msg, List <PushStaff> userDics, string appKey = "9b725db3484eceb1abab684a", string masterSecret = "7a6081367b0d0dda83a8b969") { JPushClient client = new JPushClient(appKey, masterSecret); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); foreach (PushStaff item in userDics) { pushPayload.audience = Audience.s_alias(item.UserName); pushPayload.options.time_to_live = 30; if (item.IsPushVoice) { msg.IsPushVoice = true; pushPayload.message = Message.content(JsonConvert.SerializeObject(msg)); } else { msg.IsPushVoice = false; pushPayload.message = Message.content(JsonConvert.SerializeObject(msg)); } try { var result = client.SendPush(pushPayload); } catch { } } }
/// <summary> /// 极光推送服务 /// </summary> /// <param name="userid">用户ID</param> /// <param name="Msg">用户ID</param> public static void PushiOS_Android(string userid, string Msg) { try { JPushClient pushClient = new JPushClient(Config.app_key, Config.masterSecret); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); pushPayload.audience = Audience.s_alias(userid); var options = new Options(); options.apns_production = false; //true表示IOS 生产环境 false 表示开发环境 pushPayload.options = options; //如果默认不设置则表示开发环境 var notification = new Notification(); // "您有新的订单,请处理" notification.IosNotification = new IosNotification().setAlert(Msg) .setBadge(1) .setSound("happy") .AddExtra("from", "JPush"); notification.AndroidNotification = new AndroidNotification().setAlert(Msg).AddExtra("from", "JPush"); pushPayload.notification = notification; var result = pushClient.SendPush(pushPayload); } catch (Exception ex) { System.Diagnostics.Debug.Print(ex.Message); } }
public static PushPayload PushObject_All_Message(string message, string uid) { PushPayload pushPayload = new PushPayload(); if (string.IsNullOrEmpty(uid)) { pushPayload = new PushPayload() { platform = Platform.all(), audience = Audience.all(), notification = new Notification().setAlert(message) }; } else { pushPayload = new PushPayload() { platform = Platform.all(), //audience = Audience.s_registrationId(uid), audience = Audience.s_alias(uid), notification = new Notification().setAlert(message) }; } return(pushPayload); }
private static PushPayload PushObject_All_All_Alert(string[] alias, string alert, string title, string moduleKey, string moduleValue) { if (!string.IsNullOrWhiteSpace(DemoKey)) { var newAlias = new List <string>(); Array.ForEach(alias, item => { newAlias.Add(DemoKey + item); }); alias = newAlias.ToArray(); } PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alias); var notification = new Notification(); string ModuleKey = "ModuleKey"; string ModuleValue = string.Format("{0}|{1}", moduleKey, moduleValue); if (!string.IsNullOrEmpty(ModuleKey) && !string.IsNullOrEmpty(ModuleValue)) { notification.AndroidNotification = new AndroidNotification().setAlert(alert).AddExtra(ModuleKey, ModuleValue).setTitle(title); notification.IosNotification = new IosNotification().setAlert(alert).incrBadge(1).setSound("happy").AddExtra(ModuleKey, ModuleValue); } else { notification.AndroidNotification = new AndroidNotification().setAlert(alert).setTitle(title); notification.IosNotification = new IosNotification().setAlert(alert).incrBadge(1).setSound("happy"); } pushPayload.notification = notification; string apns_production = ConfigurationManager.AppSettings["apns_production"]; pushPayload.options.apns_production = (!string.IsNullOrEmpty(apns_production) && apns_production.ToLower() == "true") ? true : false; return(pushPayload); }
/// <summary> /// 极光推送方法 /// </summary> /// <param name="model"></param> public static void PushMessage(JPushModel model) { try { string appKey = ""; string masterSecret = ""; if (model.TagId == 0) //C端 { appKey = "dce902893245e99461b9a5c8"; // Your App Key from JPush masterSecret = "fdc95d37d67c9472ad4e0e96"; // Your Master Secret from JPush } else if (model.TagId == 1) //B端 { appKey = "d794d51f2ffaf5de42001c4b"; // Your App Key from JPush masterSecret = "03f956afaaeb086481aa3b7c"; // Your Master Secret from JPush } JPushClient client = new JPushClient(appKey, masterSecret); Audience audience = null; if (model.PushType == 0) { //0:标签,因为一个应用只能有一个标签,现有支付已经使用,其它应用请使用别名 audience = Audience.s_alias(model.RegistrationId); model.ContentKey = "Content"; } if (model.PushType == 1) { //1:别名 audience = Audience.s_tag(model.RegistrationId); } PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); pushPayload.audience = audience; Notification notification = new Notification().setAlert(model.Alert);//不需要写弹出内容 notification.AndroidNotification = new AndroidNotification().setTitle(model.Title); notification.IosNotification = new IosNotification().setAlert(model.Alert).setBadge(1).setSound(string.Concat(model.ContentKey, ":", model.Content)); if (!string.IsNullOrEmpty(model.Content)) { //notification.IosNotification = new IosNotification().setAlert(model.Alert).setBadge(1).setSound("YourSound").AddExtra(model.ContentKey, model.Content); notification.AndroidNotification = new AndroidNotification().AddExtra(model.ContentKey, model.Content); } pushPayload.notification = notification.Check(); var response = client.SendPush(pushPayload); if (!response.isResultOK()) { LogHelper.LogWriter("推送失败", response.msg_id); } else { LogHelper.LogWriter("推送成功", response.msg_id); } } catch (Exception ex) { string parm = string.Concat("推送异常,参数:tagId", model.TagId, ",RegistrationId:", model.RegistrationId); LogHelper.LogWriter(ex, parm); } }
/// <summary> /// 极光推送主程序 /// </summary> /// <param name="_app_key">极光app_key</param> /// <param name="_master_secret">极光master_secret</param> /// <param name="title">通知标题(只支持Android)</param> /// <param name="alert">通知内容</param> /// <param name="shebeitype">设备类型(0-Android,1-IOS)</param> /// <param name="extra">参数字典</param> /// <param name="registrationid">设备标识(为空则推送全部用户)</param> /// <returns></returns> public static MessageResult SendPushJiGuang(string title, string alert, int?shebeitype, Dictionary <string, object> extra, HashSet <string> alias) { //logger.Info("*****开始发送******"); try { JPushClient client = new JPushClient(app_key, master_secret); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); if (alias != null && alias.Count() > 0) { pushPayload.audience = Audience.s_alias(alias); } else { pushPayload.audience = Audience.all(); } var notification = new Notification().setAlert(alert); //if (shebeitype == 0) //{ notification.AndroidNotification = new AndroidNotification(); notification.AndroidNotification.setTitle(title); if (extra != null && extra.Count > 0) { foreach (var item in extra) { notification.AndroidNotification.AddExtra(item.Key, item.Value.ToString()); } } //} //else //{ notification.IosNotification = new IosNotification(); notification.IosNotification.disableBadge(); notification.IosNotification.setBadge(0); notification.IosNotification.setSound("default"); if (extra != null && extra.Count > 0) { foreach (var item in extra) { notification.IosNotification.AddExtra(item.Key, item.Value.ToString()); } } //} pushPayload.notification = notification.Check(); var result = client.SendPush(pushPayload); return(result); } catch (APIRequestException e) { logger.ErrorFormat("推送失败:从jpush服务器错误响应。检查并修复它. <br>HTTP状态:{0}<br>错误代码:{1}<br>错误消息:{2}", e.Status, e.ErrorCode, e.ErrorMessage); } catch (APIConnectionException e) { logger.Error("推送失败" + e.Message); } return(null); }
public static PushPayload PushObject_all_alias_alert(User user) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); pushPayload.audience = Audience.s_alias("alias1"); pushPayload.notification = new Notification().setAlert(user.MessageAlert); return(pushPayload); }
public PushPayload PushObject_all_alias_alert(string[] alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(message); return(pushPayload); }
public static PushPayload PushObject_Android_And_IOS_AliasAlert(string alias, string text) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(text); return(pushPayload); }
/// <summary> /// 极光针对别名推送 /// </summary> /// <param name="alisa"></param> /// <param name="obj"></param> /// <returns></returns> private static PushPayload PushObject_all_alisa_Alter(string alisa, Dictionary <string, string> obj) { var pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alisa); pushPayload.notification = new Notification().setAlert(obj.ToString()); return(pushPayload); }
public static PushPayload PushObject_all_alia_alert(string strMsg, string alias) { PushPayload pushPayload_alias = new PushPayload(); pushPayload_alias.platform = Platform.android(); pushPayload_alias.audience = Audience.s_alias(alias); pushPayload_alias.notification = new Notification().setAlert(strMsg); return(pushPayload_alias); }
/// <summary> /// 推送消息给特定别名的用户 /// </summary> /// <returns></returns> public static bool PushObject_all_alias_alert(string alias, string alert) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alias);//这里推送给别名为alias1的用户 pushPayload.notification = new Notification().setAlert(alert); return(SendPush(pushPayload)); }
public static PushPayload PushObject_all_alias_alert() { PushPayload pushPayload_alias = new PushPayload(); pushPayload_alias.platform = Platform.android(); pushPayload_alias.audience = Audience.s_alias("alias1"); pushPayload_alias.notification = new Notification().setAlert(ALERT); return(pushPayload_alias); }
/// <summary> /// 推送给指定用户(个人或群组) /// 用别名来标识一个用户。一个设备只能绑定一个别名,但多个设备可以绑定同一个别名。一次推送最多 1000 个 /// </summary> /// <param name="content">通知内容</param> /// <param name="alias">用户群组</param> /// <returns></returns> public static PushPayload PushObject_All_Alias(string content, string[] alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(content); return(pushPayload); }
public static PushPayload PushObject_all_alias_alert(string msg, string alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(msg); return(pushPayload); }
public static PushPayload PushToAllAlias(string title, string content, string[] alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = Notification.android(content, title); return(pushPayload); }
//别名自动推送(单据申请,考勤提醒) public static PushPayload PushObject_auto_alias(string companyId, string[] selects, string content, string info, string companyTag) { var pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); pushPayload.audience = Audience.s_alias(selects).tag_and(companyId); pushPayload.message = Message.content(content).AddExtras("Tag", "2").AddExtras("CompanyTag", companyTag); pushPayload.notification = Notification.android(info, TITLE); return(pushPayload); }
public static void Push_all_alias_message(string[] alias, string message) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); pushPayload.audience = Audience.s_alias(alias); pushPayload.message = Message.content(message); Push(pushPayload); }
public static PushPayload PushObject_new_user(string userName, string companyName) { var pushPayload = new PushPayload(); pushPayload.platform = Platform.android(); pushPayload.audience = Audience.s_alias(userName); pushPayload.message = Message.content("欢迎来到张量公司办公系统!").AddExtras("Tag", "2").AddExtras("CompanyTag", "1"); pushPayload.notification = Notification.android("欢迎来到" + companyName, TITLE); return(pushPayload); }
public static PushPayload PushObject_all_alias_alert(string mobile, string msg) { PushPayload pushPayload_alias = new PushPayload(); pushPayload_alias.platform = Platform.all(); pushPayload_alias.audience = Audience.s_alias(mobile); pushPayload_alias.notification = new Notification().setAlert(msg); pushPayload_alias.ResetOptionsApnsProduction(false); return(pushPayload_alias); }
/// <summary> /// 发送推送 /// </summary> /// <param name="alert">推送内容</param> /// <param name="MemberIds">推送到的用户用逗号分隔, 如果留空则为全部用户</param> /// <param name="MerId">商家ID</param> public void SendPush(string alert, string MemberIds, string eventStr, decimal MerId, string[] tag) { string[] sa = { "JPushAppKey", "JPushMasterSecret" }; Dictionary <string, string> MerConfig = BLL.StaticBLL.MerConfig(MerId, sa); JPushClient client = new JPushClient(MerConfig["JPushAppKey"], MerConfig["JPushMasterSecret"]); PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.all(); var notification = new Notification().setAlert(alert); AndroidNotification androidNotification = new AndroidNotification(); IosNotification iosNotification = new IosNotification(); Options options = new Options(); options.apns_production = true; //生产环境的 pushPayload.options = options; androidNotification.AddExtra("eventStr", eventStr); iosNotification.AddExtra("eventStr", eventStr); notification.setAndroid(androidNotification); notification.setIos(iosNotification); if (MemberIds.Trim() != "") { //如果不为空,说明指定了MemberId string[] MemberArray = MemberIds.Split(','); pushPayload.audience = Audience.s_alias(MemberArray); //推送设备对象,表示一条推送可以被推送到那些设备,确认推送设备的对象,JPush提供了多种方式,比如:别名,标签,注册id,分群,广播等。 } else if (tag != null) { if (tag.Length > 0) { pushPayload.audience = Audience.s_tag(tag); //按照标签推送 } } else { pushPayload.audience = Audience.all();//推送设备对象,表示一条推送可以被推送到那些设备,确认推送设备的对象,JPush提供了多种方式,比如:别名,标签,注册id,分群,广播等。 } pushPayload.notification = notification; pushPayload.message = Message.content("msg") .AddExtras("DoEvent", "GetNewMsgNum()"); //如果不加一条自定义消息的话, android是不会触发监听事件的.但是IOS可以 var result = client.SendPush(pushPayload); }
public static PushPayload PushObject_ios_audienceMore_messageWithExtras(string[] alias, string from) { var pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); //pushPayload.audience = Audience.s_tag("tag1","tag2"); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(ALERT); pushPayload.message = Message.content(MSG_CONTENT).AddExtras("from", from); return(pushPayload); }
public static void Push_all_alias_alert_message(string alert, string message, params string[] alias) { PushPayload pushPayload = new PushPayload(); pushPayload.platform = Platform.android_ios(); pushPayload.audience = Audience.s_alias(alias); pushPayload.notification = new Notification().setAlert(alert); pushPayload.message = Message.content(message); Push(pushPayload); }
public void sendByAliasMore() { PushPayload payload = new PushPayload(); payload.platform = Platform.all(); payload.audience = Audience.s_alias(ALIAS1, ALIAS2); payload.notification = new Notification().setAlert(ALERT); var result = _client.SendPush(payload); Assert.IsTrue(result.isResultOK()); }