这是我在index.js中的代码:
firebase.messaging().setBackgroundMessageHandler(async(remoteMessgae) => {
console.log('Listening in Background ...')
await AsyncStorage.setItem('isUserLoggedIn', 'false')
PushNotification.localNotification({
title: 'Test Title',
message: 'Test Message'
})
})
AppRegistry.registerComponent(appName, () => App)
虽然我在后台/应用程序关闭时收到通知,但console / AsyncStorage却无法正常工作。