Giter Site home page Giter Site logo

Comments (10)

helenaford avatar helenaford commented on July 20, 2024

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.

ccorneliusHsv avatar ccorneliusHsv commented on July 20, 2024

@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.

helenaford avatar helenaford commented on July 20, 2024

@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.

ccorneliusHsv avatar ccorneliusHsv commented on July 20, 2024
  • 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, then messaging().onMessage is called.

from notifee.

helenaford avatar helenaford commented on July 20, 2024

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.

ccorneliusHsv avatar ccorneliusHsv commented on July 20, 2024

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.

ccorneliusHsv avatar ccorneliusHsv commented on July 20, 2024

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.

arunim2405 avatar arunim2405 commented on July 20, 2024

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.

helenaford avatar helenaford commented on July 20, 2024

@arunim2405 which options in particular did you have to set? was it foregroundPresentationOptions? Our docs have been updated to include this

from notifee.

github-actions avatar github-actions commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.