FCM.getInitialNotification().then(function(data){
alert(data.id)
});
我总是得到以前的通知数据,而不是最新的 我在应用恢复/更改appstate时调用它,如下所示
_handleAppStateChange = (nextAppState) => {
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
//console.warn('App has come to the foreground!')
FCM.getInitialNotification().then(function(data){
alert(data.id)
});
}
this.setState({appState: nextAppState});
}
预期结果是提醒最新ID