Comments (10)
hey there, thanks for the info - I've had a look through and done some tests. When the app is in the foreground, you have to use displayNotification
inside messaging().onMessage
:
await notifee.displayNotification({
title: 'hello',
body: 'world',
ios: {
attachments: [{ url: 'https://fanart.tv/fanart/movies/15596/movieposter/back-to-school-568913d00c872.jpg'}]
},
});
Hope that helps.
Also, to add, when the app is in the foreground, the notification service extension is not called.
from notifee.
@helenaford I agree with the first part of your response and have it implemented just like you described.
But, while I expected the behavior to match your statement "when the app is in the foreground, the notification service extension is not called"..that is not the behavior I am seeing. I am using the Console app to look at the logs and when the app is in the foreground and receives the push, the service extension is going through the same steps as when the app is closed or in the background.
Also - just for clarity messaging().onMessage
is called when the app is in the foreground, after the service extension is called, if I don't have the notifee_options
set.
Let me know if there is any additional testing I can do or information I can provide.
from notifee.
@ccorneliusHsv can you summarize in some bullet points the issue you're having and steps on how to recreate it? Just so I'm clear what the bug is
from notifee.
- Issue: Using the service extension model,
messaging().onMessage
is not being called when app is in Foreground - I am modifying the incoming message inside didReceiveNotificationRequest to include
notifee_options
(that code is in the original post directly under Code used to modify object) - If I don't modify the incoming message to include
notifee_options
, thenmessaging().onMessage
is called.
from notifee.
Ah ok, got it! thanks. I can 100% say onMessage
should be called but the fact you say it breaks when you're modifying the incoming message in the service extension is interesting. Also, I will check again but I'm still not sure why the extension will be getting called in the foreground 🤔 In test 1 you say it works, can you not modify it on the client? Is there a reason you need to pass fcm_options too?
from notifee.
Yes, fcm_options
are required..at least for the message sent to the device. Believe it or not our marketing team uses the FCM console to send an occasional message..and that is why that's there. I will try removing the fcm_options
in the service extension when I add the notifee_options
.
We also send other notifications and I'm currently working on modifying the format to get the Service Extension to handle it. When I get that working, I might have some more information for you.
from notifee.
Did some more testing..I was able to send a message via the Firebase API that did not include fcm_options
..observed the same behavior as with the other messages.
from notifee.
Ah ok, got it! thanks. I can 100% say
onMessage
should be called but the fact you say it breaks when you're modifying the incoming message in the service extension is interesting. Also, I will check again but I'm still not sure why the extension will be getting called in the foreground 🤔 In test 1 you say it works, can you not modify it on the client? Is there a reason you need to pass fcm_options too?
In my case I had to set the following options in my backend inside notifee_options to prevent extension and essentially the notification to be shown in foreground
notifee_options: {
//image: 'https://placeimg.com/640/480/any', // URL to pointing to a remote image
data: {
conversationData: JSON.stringify(conversationData),
},
ios: {
sound: "default", // A local sound file you have inside your app's bundle
foregroundPresentationOptions: {
alert: false,
badge: false,
sound: false,
}, // foreground Notifications are handled in App via Web Sockets
threadId: conversationData.id,
},
title: messageData.title,
body: messageData.body,
subtitle: messageData.subtitle,
// any other api properties for Notification, excluding id
},
from notifee.
@arunim2405 which options in particular did you have to set? was it foregroundPresentationOptions
? Our docs have been updated to include this
from notifee.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
from notifee.
Related Issues (20)
- [iOS] Slow observer onForegroundEvent HOT 5
- Background Push, click open App, nothing more HOT 1
- Sometimes not showing notification android HOT 2
- Implement Android Progress Indicators / Foreground Service on I HOT 1
- Implement Android Progress Indicators / Foreground Service on IOS HOT 2
- ANDROID: notification seems to be on, but after a few notifications it is necessary to turn it off and on again HOT 3
- Have a issues [ notifee_react-native:compileDebugHavaWithJavac ] HOT 3
- iOS: A way to override notifee handling push notification press HOT 5
- Unable to Schedule Daily Notifications HOT 1
- Android14 : Background Job HOT 2
- Android :: Small Icons shown only on foreground notifications but not background ones HOT 1
- I'm updated my react native version to 0.73.4 and getInitialNotification() and onNotificationOpenedApp() does not work in iOS HOT 5
- IOS: A local notification without sound and vibration HOT 1
- iOS handle consecutive push notifications with long sound HOT 1
- [iOS] Attachment image is not displayed with 'require()' on release mode HOT 1
- [Android] notifee.openAlarmPermissionSettings() on Samsung phone (Android 14) just goes to Settings app HOT 1
- Apple's privacy manifest HOT 6
- Getting TypeError: Cannot read property 'then' of undefined when calling getNotificationSettings (on Android) HOT 2
- How to remove USE_FULL_SCREEN_INTENT? HOT 14
- Android 14: Local push notifications don't disappear until user dismiss or touch them HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from notifee.