web 端发送 push[通知] 方法:
const conversation = {
conversationType: RongIMLib.ConversationType.PRIVATE, // 单聊
targetId: '<目标 Id>',
}
const message = new RongIMLib.TextMessage({
content: 'hello RongCloud!',
extra: '附加信息'
});
const options = {
pushContent: 'your pushInfo', // 推送消息内容
pushData: 'extra msg', // 远程推送中携带的非展示数据,移动端按需处理
}
// 发送消息
RongIMLib.sendMessage(conversation, message, options).then(res => {
if (res.code === RongIMLib.ErrorCode.SUCCESS) {
// 消息发送成功,可以根据返回结果中的 messageId 字段将列表中的该消息状态改为发送成功。
console.log('消息发送成功', res.data)
} else {
console.log('消息发送失败', res.code, res.msg)
}
})
1.接收方: iOS 端
pushContent (推送内容)
msgContent (消息内容)
2.接收方: Android 端
pushContent: 需要在杀死进程且设备开启推送的权限,安卓才能收到锁屏界面的 pushContent 消息
pushContent (推送内容)
msgContent(消息内容)