![慕聊第14章源码消息推送方式_第1页](http://file4.renrendoc.com/view/23218e9cc47b320f9b0abd35ae87d24d/23218e9cc47b320f9b0abd35ae87d24d1.gif)
![慕聊第14章源码消息推送方式_第2页](http://file4.renrendoc.com/view/23218e9cc47b320f9b0abd35ae87d24d/23218e9cc47b320f9b0abd35ae87d24d2.gif)
![慕聊第14章源码消息推送方式_第3页](http://file4.renrendoc.com/view/23218e9cc47b320f9b0abd35ae87d24d/23218e9cc47b320f9b0abd35ae87d24d3.gif)
![慕聊第14章源码消息推送方式_第4页](http://file4.renrendoc.com/view/23218e9cc47b320f9b0abd35ae87d24d/23218e9cc47b320f9b0abd35ae87d24d4.gif)
![慕聊第14章源码消息推送方式_第5页](http://file4.renrendoc.com/view/23218e9cc47b320f9b0abd35ae87d24d/23218e9cc47b320f9b0abd35ae87d24d5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
场景2:用户定制了某本书的预订更新,当本书有更新时,需要向该用户及时下更新提醒信息。IPushResultpushMessageToSingle(SingleMessagemessage,TargetIPushResultpushMessageToSingle(SingleMessagemessage,TargetString用是无是无否无importimportimportcom.gexin.rp.sdk.base.impl.Target;importimport import publicclassPushtoSingleprivatestaticStringappId="";privatestaticStringappKey="";privatestaticStringmasterSecret="";staticStringCID=//staticStringAlias=staticStringhost="publicstaticvoidmain(String[]args)throw{IGtPushpush=newIGtPush(host,appKey,masterSecret);LinkTemtetemte=linkTemteDemo();SingleMessagemessage=newSingleMessage();message.setOfflrue);//离线有效时间,单位为毫秒,可选message.setOfflineExpireTime(24*3600*1000);Targettarget=newTarget();IPushResultret=null;try{ret=push.pushMessageToSingle(message,}catch(RequestException{ret=push.pushMessageToSingle(message,target,}if(ret!={}else}}publicstaticLinkTeminkTem{LinkTemtetemte=newLinkTem//设置APPID与APPKEY //设置打开 returntem 上传id或别名列表,对列表中所有id或别名用户进行消息推送,如果仅对单个用户推送务场景1,对于抽奖活动的应用,需要对已知的某些用户推送消息,就可以通过id列表方场景2,向新客用户抵用券,提升新客的转化率,就可以事先提取新客列表,将消息指定发送给这部分指定CID用户。getContentIdtaskIdStringString是无否无是无taskId,IDOSL-是无importjava.util.List;importcom.gexin.rp.sdk.base.IPushResult;importcom.gexin.rp.sdk.base.impl.Target;importcom.gexin.rp.sdk.htt importcom.gexin.rp.sdk.tem publicclassPushList{//采用"JavaSDK快速 ","第二步获取 privatestaticStringappId="";privatestaticStringappKey="";privatestaticStringmasterSecret="";staticStringCID1="";staticStringCID2=//staticStringAlias1=//staticStringAlias2=staticStringhost=" publicstaticvoidmain(String[]args)throw ception{IGtPushpush=newIGtPush(host,appKey,masterSecret);NotificationTemtetemte=notificationTemteDemo();ListMessagemessage=newListMessage();message.setOfflineExpireTime(24*1000*Listtargets=newArrayList();Targettarget1=newTarget();Targettarget2=newTarget(); //taskId用于在推送时去查找对应的messageStringtaskIdpush.getContentId(message);IPushResultret=push.pushMessageToList(taskId,targets);}publicstaticNotificationTemtenotificationTem{NotificationTemtetemte=newNotificationTem//设置APPID与APPKEY//设置通知栏标题与内容 return taskidbooleanCancelContentId(String是无id(OSL-importimportcom.gexin.rp.sdk.htt publicclassCancelContentId{//采用"JavaSDK快速 ","第二步获取 staticStringappId="";staticStringappkey="";staticStringmaster=staticStringhost= staticStringtaskid"";publicstaticvoidmain(String[]args)IGtPushpush=newIGtPush(host,appkey,master);booleanresult=push.cancelContentId(taskid);}}注:个推使用AppID来标识每个独立的应用。接口IPushResultIPushResultpushMessageToApp(message是无否无packagepackageimportjava.util.List;importcom.gexin.rp.sdk.base.IPushResult;importcom.gexin.rp.sdk.base.im importcom.gexin.rp.sdk.htt import publicclassPushtoAPP//采用"JavaSDK快速 ","第二步获取 privatestaticStringappId="";privatestaticStringappKey=privatestaticStringmasterSecret=staticStringhost="/apiex.htm";publicstaticvoidmain(String[]args)throw ception{IGtPushpush=newIGtPush(host,appKey,LinkTemtetemte=linkTemteDemo();AppMessagemessage=newAppMessage();message.setOfflineExpireTime(24*1000*3600);AppConditionscdt=newAppConditions();List<String>appIdListnewArrayList<String>();List<String>phypeList=newList<String>proveList=newList<String>tagList=newcdt.addCondition(AppConditions.REGION,proveList);IPushResultretpush.pushMessageToApp(message,"任务别名_toApp");}publicstaticLinkTeminkTemteDemo() {LinkTemtetemte=newLinkTemte();temte.setLogo(""); return AppConditionsAppConditionscdt=newList<String> eList=new AppConditionsAppConditionscdt=newList<String> eList=new wifi主要用于富、、应用等推送,仅在wifi环境下展现推送消息,用较精美的富文本内容在message中设置setPusWorkType为1,推送时只有通过wifi登录的用户才收到消息,网络登录用户的消息进离线,等该用户wifi登录后才获取该条离线消息。//1:wifi0: //1:wifi0: packagepackageimportcom.gexin.rp.sdk.htt publicclassPushToSingle//采用"JavaSDK快速 ","第二步获取 staticStringappId="";staticStringappkey="";staticStringmastersecret="";staticStringCID=staticStringhost= publicstaticvoidmain(String[]args) {IGtPushpush=newIGtPush(host,appkey,SingleMessagemessage=new }} messagesetSpeed100100只有toapp(对指定应用群推消息)支持定速推送。packagepackageimportcom.gexin.rp.sdk.base.im importcom.gexin.rp.sdk.htt publicclassPushToAPP//采用"JavaSDK快速 ","第二步获取 staticStringappId="";staticStringappkey="";staticStringmastersecret="";staticStringCID=staticStringhost= publicstaticvoidmain(String[]args) {IGtPushpush=newIGtPush(host,appkey,AppMessagemessage=new}} 在查询数据时,只需要输入该任务组名即可同时查到n个任务的数据结果。ABtestABA、B``1'',查数据时,仅需要查找任务组1,即可以一起看到A、B两组测试的结果,可以更直观地对比数据。voidvoidtoListOfGroupName(StringhostStringappkey,Stringmastersecret,ListMessagemessage,StringtaskGroupName/*任务组名*/){IGtPushpush=newIGtPush(host,appkey,mastersecret);push.getContentId(message,taskGroupName);}voidvoidtoListOfGroupName(StringhostStringappkey,Stringmastersecret,AppMessagemessage,StringtaskGroupName/*任务组名*/){IGtPushpush=newIGtPush(host,appkey,mastersecret);push.pushMessageToApp(message,taskGroupName);}场景:需要发送给城市在A,B,C里面,没有设置tagtest, 件交并补功能可以实现,city(A|B|C)&&!tag(tagtest)&&ph AppConditionsaddCondition(Stringkey,List<String>values,int是无查询条件键 ype类型,region省市,tag用户是无否0(OptType.orOptType.andOptType.notpackagepackageimportjava.util.List;importcom.gexin.rp.sdk.base.IPushResult;importcom.gexin.rp.sdk.base.im importimportimportimportpublicclass{staticStringappId="";staticStringappkey="";staticStringmaster=staticStringhost=publicstaticvoidmain(String[]args) ceptionIGtPushpush=newIGtPush(host,appkey,master); tetem te=linkTem AppMessagemessage=newAppMessage(); message.setOfflineExpireTime(24*1000*List<String>phypeList=newArrayList<String>();List<String>proveList=newArrayList<String>();List<String>tagList=newArrayList<String>(); AppConditionscdt=newAppConditions();cdt.addCondition(AppConditions.PHONE_TYPE,phypeList,OptType.or);cdt.addCondition(AppConditions.REGION,proveList,OptType.or);cdt.addCondition(AppConditions.TAG,tagList,OptType.or);IPushResultret=push.pushMessageToApp(message,"taskName_toApp");}publicstaticLinkTeminkTemteDemo() {LinkTemtetemte=newLinkTemte();temte.setLogo(""); returntem }}Stringadd(SingleMessagemessage,TargetIPushResultIPushResultIPushResultinfo果。返回值点击IpushResult返回值importcom.gexin.rp.sdk.base.IBatch;importcom.gexin.rp.sdk.base.IIGtPush;importcom.gexin.rp.sdk.base.IBatch;importcom.gexin.rp.sdk.base.IIGtPush;importcom.gexin.rp.sdk.base.impl.Target;importcom.gexin.rp.sdk.htt import importjava.util.Map;publicclassMyBatchPushDemo//采用"JavaSDK快 privatestaticStringappId="";privatestaticStringappKey=privatestaticStringma
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 宠物医院院感知识与防控措施考核试卷
- 建筑材批发供应链管理考核试卷
- 二零二五年度腻子粉行业绿色生产设备采购合同
- 市场需求预测与趋势分析考核试卷
- 2025-2030年地下三维成像雷达行业深度调研及发展战略咨询报告
- 2025-2030年厨房重油污清洁剂行业跨境出海战略研究报告
- 2025-2030年即食章鱼烧罐头企业制定与实施新质生产力战略研究报告
- 摩托车发动机气缸磨损测量考核试卷
- 2025-2030年数据报告卡行业深度调研及发展战略咨询报告
- 2025-2030年手持削皮器行业深度调研及发展战略咨询报告
- 高考模拟作文“文化自信:春节走向世界”导写+范文3篇
- 药品管理法律制度的创新与探索
- 苏教版三年级下册数学计算能手1000题带答案
- 道路清障救援作业服务投标方案(完整技术标)
- 迈瑞医疗 -医疗器械-从全球器械巨头发展看迈瑞海外进击之路
- 2014年10月自考00567马列文论选读试题及答案含解析
- 改善护理服务行动计划总结报告
- 智慧农业整体架构规划设计方案
- 湖南汽车工程职业学院单招职业技能测试参考试题库(含答案)
- 第2课+古代希腊罗马(教学设计)-【中职专用】《世界历史》(高教版2023基础模块)
- 中储粮兰州公司考试笔试题库
评论
0/150
提交评论