Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Firebase Messaging: fix Android notification body and title not sent to Flutter #672

Merged
merged 8 commits into from
Sep 4, 2018
Merged

Conversation

bkayfitz-cara
Copy link
Contributor

The Firebase Messaging plugin for Android only seems to send the custom properties that can be included with a push notification to Flutter - it doesn't send any of the core message components, like the title or body.

For example, if you send this message:

title: My Notification
body: Hello World!
customProperty: foo

The flutter plugin will only receive {"customProperty": "foo"}

This is not an issue one the iOS side, which sends the entire apns payload to Flutter.

This change just adds the title and body properties for now, but maybe other properties should be added as well?

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@bkayfitz-cara
Copy link
Contributor Author

bkayfitz-cara commented Jul 18, 2018 via email

@googlebot
Copy link

CLAs look good, thanks!

@kroikie kroikie self-assigned this Jul 18, 2018
Copy link
Contributor

@kroikie kroikie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please bump the version number of the plugin and add a note to the CHANGELOG.

Map<String, Object> content = new HashMap<>();
content.put("data", message.getData());

RemoteMessage.Notification notification = message.getNotification();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since notification can be null if the a data-message is sent, please check for null before adding the properties of the Notification to the content passed to the Dart side.

@kroikie
Copy link
Contributor

kroikie commented Jul 23, 2018

@bkayfitz-cara We had some formatting issues last week, would you mind rebasing on master, all builds should pass and I'll be happy to merge.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@kroikie
Copy link
Contributor

kroikie commented Jul 26, 2018

@bkayfitz-cara Would you be able to resolve the conflicts and then I'll be happy to merge. Thanks for the PR.

@googlebot
Copy link

CLAs look good, thanks!

Copy link
Contributor

@kroikie kroikie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, please fix nit and I'll merge.

}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove unnecessary empty line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkayfitz-cara fixed nit so I'll merge. Thanks very much for this PR.

@kroikie kroikie merged commit 7f9fdbf into flutter:master Sep 4, 2018
nichtverstehen pushed a commit to nichtverstehen/plugins that referenced this pull request Sep 6, 2018
…to Flutter (flutter#672)

* sending notification title and body to flutter

* Safety checks for null pointer exceptions

* Use remote data scheme on dart side
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
…to Flutter (flutter#672)

* sending notification title and body to flutter

* Safety checks for null pointer exceptions

* Use remote data scheme on dart side
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
…to Flutter (flutter#672)

* sending notification title and body to flutter

* Safety checks for null pointer exceptions

* Use remote data scheme on dart side
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants