【发布时间】:2017-08-10 16:25:15
【问题描述】:
我正在使用 react-native-push-notification 库向 android 推送通知。 我使用 GCM 从我的服务器收到通知。 我得到了“onNotification”功能,当我控制台它时,我在控制台中看到消息通知。 如何呈现通知并向用户显示每个通知,包括按钮?我尝试通过状态或调用函数保存接收到的通知,但它不起作用,似乎不知道外部函数。
这是代码-
componentDidMount(){
PushNotification.configure({
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification );
},
senderID: "********",
popInitialNotification: true,
});
}
render() {
return(
<View>
<Text>Notification</Text>
</View>
);
}
}
谢谢!
【问题讨论】:
标签: android react-native push-notification