客户端可以给每个用户注册一个别名alias,和多个标签tag。
到时候,就可以给这些别名和标签发送推送了。
也可以给所有跟这个客户端有关联的用户发送消息。
setPlatform设置平台
setPlatform(Mall) //设置所有平台
setPlatform(Mplatform('ios', 'android'))//设置android和ios
setAudience设置受众
setAudience(Mall)设置所有受众
setAudience(Maudience(M ag(array('tag1','tag2'))))//设置tag为tag1或tag2的受众,群发
setAudience(Maudience(Malias(array('123')))) //设置别名alias为123的受众,单发
setAudience(Maudience(Malias(array('1','123')),M ag(array('tag1','tag2'))))//取交集,也就是别名为1,且其tag值为tag1或tag2的用户才能收到推送
setNotification设置通知
setNotification(M otification('Hi, JPush')) //设置通用通知
setNotification(M otification('Hi, JPush', Mandroid('Hi, android'))) //为安卓单独设置信息,ios则是显示第一个内容,也就是除了android之外的都是Hi,JPush
setNotification(M otification('Hi, JPush', Mios('Hi, ios','happy',1,true)))//为ios单独设置信息
setNotification(M otification('Hi, JPush', Mandroid('Hi, android'), Mios('Hi, ios', 'happy', 1, true))) //两个都设置
如果想把一个推送关联一个新闻,可以通过参数extras