Skip to content

[Messaging] Add new Registration methods - #1891

Merged
a-maurice merged 12 commits into
mainfrom
am-messaging_registration
Aug 10, 2026
Merged

[Messaging] Add new Registration methods#1891
a-maurice merged 12 commits into
mainfrom
am-messaging_registration

Conversation

@a-maurice

Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

Adds support for the new Messaging registration method, which uses Installation Ids over the old FCM tokens. Note that it is not on by default, and requires setting the appropriate variable in the Android or iOS project.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Running Android and iOS tests locally


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new registration and unregistration mechanism using Firebase Installation IDs (FIDs) to replace the deprecated token-based registration in Firebase Messaging. It adds Register() and Unregister() APIs, introduces OnRegistrationReceived and OnUnregistrationReceived callbacks to the Listener and PollableListener classes, and updates the Android, iOS, and stub implementations accordingly. Two issues were identified in the test code: an unused variable expected_error in integration_test.cc that could trigger compiler warnings, and a logical contradiction in TestUnregistrationClearsCachedRegistration within messaging_test.cc that will cause test failures on the Android desktop stub.

Comment thread messaging/tests/messaging_test.cc Outdated
Comment thread messaging/integration_test/src/integration_test.cc Outdated
@a-maurice

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new registration and unregistration methods using Firebase Installation IDs (FIDs) in the Firebase Messaging C++ SDK, deprecating the older token-based registration methods across Android, iOS, and stub implementations. The changes include updates to the C++ API, JNI bindings, Java services, iOS delegates, and flatbuffer schemas, along with comprehensive integration and unit tests. The review feedback recommends adding defensive null checks in MessageReader::ConsumeRegistrationReceived and MessageReader::ConsumeUnregistrationReceived to prevent potential null pointer dereferences and crashes when processing malformed flatbuffer payloads.

Comment thread messaging/src/android/cpp/message_reader.cc
Comment thread messaging/src/android/cpp/message_reader.cc
@a-maurice
a-maurice requested a review from AustinBenoit July 28, 2026 21:16
@a-maurice
a-maurice merged commit 25222c2 into main Aug 10, 2026
39 checks passed
@github-actions github-actions Bot added the tests: in-progress This PR's integration tests are in progress. label Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

❌  Integration test FAILED

Requested by @a-maurice on commit 25222c2
Last updated: Mon Aug 10 14:15 PDT 2026
View integration test log & download artifacts

Failures Configs
messaging [TEST] [FAILURE] [Android] [All 3 os] [1/2 android_device: emulator_ftl_target]
(1 failed tests)  FirebaseMessagingTest.TestRegisterAndUnregister
[TEST] [FAILURE] [Linux] [x64] [openssl]
(2 failed tests)  FirebaseMessagingTest.TestRegisterAndUnregister
  FirebaseMessagingTest.TestRegistrationOnInitEnabled
[TEST] [FAILURE] [Windows] [x64] [openssl]
(2 failed tests)  FirebaseMessagingTest.TestRegisterAndUnregister
  FirebaseMessagingTest.TestRegistrationOnInitEnabled

Add flaky tests to go/fpl-cpp-flake-tracker

@a-maurice
a-maurice deleted the am-messaging_registration branch August 10, 2026 20:46
@github-actions github-actions Bot added the tests: failed This PR's integration tests failed. label Aug 10, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Aug 10, 2026
Comment thread messaging/src/common.cc
}
MutexLock lock(g_listener_lock);
if (g_prev_registration_received &&
*g_prev_registration_received == installationId) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We probably shouldn't have this check here.

By design, every explicit call to Register() should invoke the didReceiveRegistration callback regardless whether FID has changed or not.

To avoid behavior divergence from Android and iOS SDK, we could simply invoke the callback here without additional checks. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I can look into removing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: failed This PR's integration tests failed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants