未接收来自Android中Firebase的通知,但已建立连接 版本 @react本机firebase/应用程序:6.3.4 @react本机firebase/消息:6.3.4 反应:16.9.0 反应本机:0.61.4
在我的App.js文件中,我正在注册这样的通知未接收来自Android中Firebase的通知,但已建立连接 版本 @react本机firebase/应用程序:6.3.4 @react本机firebase/消息:6.3.4 反应:16.9.0 反应本机:0.61.4,android,firebase,react-native,push-notification,react-native-firebase,Android,Firebase,React Native,Push Notification,React Native Firebase,在我的App.js文件中,我正在注册这样的通知 ... import messaging from '@react-native-firebase/messaging'; const App: () => React$Node = () => { const registerForNotifications = async () => { const granted = await messaging().requestPermission(); if (
...
import messaging from '@react-native-firebase/messaging';
const App: () => React$Node = () => {
const registerForNotifications = async () => {
const granted = await messaging().requestPermission();
if (granted) {
console.log('User granted messaging permissions!');
} else {
console.log('User declined messaging permissions :(');
}
await messaging().registerForRemoteNotifications();
const unsubscribe = messaging().onMessage(async remoteMessage => {
console.log('FCM Message Data:', remoteMessage.data);
});
const token = await messaging().getToken();
console.log({token});
return unsubscribe;
};
useEffect(() => {
SplashScreen.hide();
registerForNotifications();
}, []);
...
}
它向我展示了用户授予了消息传递权限,它似乎正确地注册了远程通知,最后我得到了令牌,它似乎是正常的,并已连接
在firebase消息控制台中,我发送一个新通知,在可能的目标中,它似乎是我的用户(在云消息菜单中)
因此,我没有看到任何错误,但出于某种原因,我发送了多个通知,但我没有收到它们,无论应用程序是打开还是关闭。我不知道该怎么办,因为我看不到任何错误。我面临着同样的问题,这方面有什么更新吗?我面临着同样的问题,这方面有什么更新吗?