//监听系统通知栏消息点击事件

plus.push.addEventListener("click", function(msg) {
	//plus.nativeUI.alert(JSON.stringify(msg));
	//逻辑处理
}, false);

//监听接收透传消息事件

plus.push.addEventListener("receive", function(msg) {
	//plus.nativeUI.alert(JSON.stringify(msg));
	//receiveData(msg, '2');
}, false);

let receiveData = function(msg,num) {
	if(uni.getSystemInfoSync().platform == 'ios') {
		if (msg.type == "receive") {  
			//创建本地消息,发送的本地消息也会被receive方法接收到,
			plus.push.createMessage(msg.content, JSON.stringify(msg), {title: msg.title});  
		}  
	} 
}
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐