Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[messaging] Please publicly expose the functionality of DisplayNotification.java #3610

Closed
sfuqua opened this issue Apr 1, 2022 · 3 comments
Labels

Comments

@sfuqua
Copy link

sfuqua commented Apr 1, 2022

What feature would you like to see?

This class, DisplayNotification:

is responsible for the "automagical" behavior of Android Firebase Cloud Messaging, wherein the SDK will automatically display an Android notification if a message is received while the app is in the background.

This automatic behavior is a point of contention in the developer community since there is no current way to customize or opt-out of the display notification, but as long as the SDK is opinionated about doing this, I would like a way to mimic the SDK's behavior while the app is foregrounded.

So I would appreciate it if a public variant of DisplayNotification could be exposed by the SDK, ideally taking a RemoteMessage instance in a constructor, that would allow me to generate and display an Android Notification in the same style as created by the SDK.

This would allow consistent presentation by an app regardless of whether the message is received in the foreground or background.

How would you use it?

Today, if I specify "image" in my FCM payload, the SDK will automatically download and display the image in a Notification using BigPictureStyle, which is convenient - but it only does this when the app is backgrounded.

When the app is foregrounded I have to recreate this Notification myself, manually, and for consistency I find myself basically copying the same styling the SDK uses. It'd be great if the SDK just exposed its helpers to me so I could literally display the same Notification that it automatically creates. This also applies to the logic the SDK uses for icons, strings, etc.

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@sfuqua
Copy link
Author

sfuqua commented Apr 1, 2022

Possible duplicate of #1663

@argzdev
Copy link
Contributor

argzdev commented Apr 1, 2022

Hi @sfuqua, thanks for the request!

To avoid duplicates of feature requests, I'll be closing this now. That being said, what we can do here is that, I added a comment to issue 1663, that way this can be visible to people checking the request.

Also can you give the issue 1663 a thumbs up? This is a huge help to our engineers, since this is the way we track requests of our developers to see what is highly suggested and then we can prioritize accordingly. Thanks again!

@argzdev argzdev closed this as completed Apr 1, 2022
@firebase firebase locked and limited conversation to collaborators May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants