// When the application is running, but in the background
messaging().onNotificationOpenedApp(remoteMessage =>{
console.log('[FCMService] onNotificationOpenedApp Notification caused app to open from background state:',
remoteMessage,);// يظهر فى الكونسول // onNotificationOpenedApp Notification caused app to open from background state: null// null اعتقد ان المشكلة تكمن فى
هذا هو الكود بالكامل ..
createNotificationListeners =(
onRegister:(arg0: string)=>void,
onNotification:(
arg0:FirebaseMessagingTypes.Notification|undefined,
arg1:{[key: string]: string}|undefined,)=>void,
onOpenNotification:(
arg0:FirebaseMessagingTypes.Notification|undefined,
arg1:{[key: string]: string}|undefined,)=>void,)=>{// When the application is running, but in the background
messaging().onNotificationOpenedApp(remoteMessage =>{// null هنا المشكلة حيث انه يطبع فى الكونسول
console.log('[FCMService] onNotificationOpenedApp Notification caused app to open from background state:',
remoteMessage,);if(remoteMessage){const notification = remoteMessage.notification;
onOpenNotification(notification, remoteMessage.data);}});// When the application is opened from a quit state.
messaging().getInitialNotification().then(remoteMessage =>{
console.log('[FCMService] getInitialNotification Notification caused app to open from quit state:',
remoteMessage,);if(remoteMessage){const notification = remoteMessage.notification;
onOpenNotification(notification, remoteMessage.data);}});// Foreground state messagesthis.messageListener = messaging().onMessage(async remoteMessage =>{
console.log('[FCMService] A new FCM message arrived!', remoteMessage);if(remoteMessage){
let notification =null;if(Platform.OS ==='ios'){
notification = remoteMessage.notification;}else{
notification = remoteMessage.notification;}
onNotification(notification, remoteMessage.data);}});// Triggered when have new token
messaging().onTokenRefresh(fcmToken =>{
console.log('[FCMService] New token refresh: ', fcmToken);
onRegister(fcmToken);});};
السؤال
أحمد عبد الله2
الاشعارات لاتعمل والهذه الميثود
هذا هو الكود بالكامل ..
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.