Skip to content

feat(fcm): Enable fid and deprecate token for Send API#1211

Open
yvonnep165 wants to merge 4 commits into
mainfrom
yp-add-fid-arg
Open

feat(fcm): Enable fid and deprecate token for Send API#1211
yvonnep165 wants to merge 4 commits into
mainfrom
yp-add-fid-arg

Conversation

@yvonnep165
Copy link
Copy Markdown

This change deprecates token (in Message) and tokens (in MulticastMessage) as message targets, transitioning support to fid (Firebase Installation ID) and fids as the primary targets instead.

@yvonnep165 yvonnep165 added release-note release:stage Stage a release candidate labels May 21, 2026
Copy link
Copy Markdown
Contributor

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

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 support for Firebase Installation IDs (FIDs) as message targets in the FCM SDK, deprecating registration token fields in favor of FIDs across the Message and MulticastMessage classes. Feedback indicates that the current implementation of MulticastMessage.getMessageList() fails to preserve the relative order of tokens and FIDs, which violates the API contract requiring response order to match the input order. Additionally, the class-level documentation for MulticastMessage needs to be updated to reflect the new combined limit of 500 for tokens and FIDs.

Comment thread src/main/java/com/google/firebase/messaging/MulticastMessage.java
Comment thread src/main/java/com/google/firebase/messaging/MulticastMessage.java
@yvonnep165
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

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

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 support for Firebase Installation IDs (FIDs) as message targets across the messaging API, including the Message and MulticastMessage classes. It deprecates registration tokens in favor of FIDs, updates validation logic to enforce a single target type per message, and adjusts multicast processing to handle a combined limit of 500 targets. A review comment suggests clarifying the MulticastMessage Javadoc to accurately reflect that responses are ordered by tokens first followed by FIDs, rather than strictly by the interleaved addition order.

Comment on lines +41 to +46
* <p>This class and the associated Builder retain the order of tokens and FIDs. Therefore
* the order of the responses list obtained by calling {@link BatchResponse#getResponses()}
* on the return value of {@link FirebaseMessaging#sendMulticast(MulticastMessage)}
* corresponds to the order in which targets were added to the
* {@link MulticastMessage.Builder}. If both tokens and FIDs are provided, tokens are
* processed first, followed by FIDs.
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.

medium

The Javadoc states that the response order corresponds to the order in which targets were added to the builder. However, the implementation groups tokens first and then FIDs (as noted in the subsequent sentence), which means the response order will not match the addition order if tokens and FIDs were interleaved. The documentation should be clarified to reflect that the order is preserved within each group (tokens then FIDs).

Suggested change
* <p>This class and the associated Builder retain the order of tokens and FIDs. Therefore
* the order of the responses list obtained by calling {@link BatchResponse#getResponses()}
* on the return value of {@link FirebaseMessaging#sendMulticast(MulticastMessage)}
* corresponds to the order in which targets were added to the
* {@link MulticastMessage.Builder}. If both tokens and FIDs are provided, tokens are
* processed first, followed by FIDs.
* <p>This class and the associated Builder retain the order of tokens and FIDs. Therefore
* the order of the responses list obtained by calling {@link BatchResponse#getResponses()}
* on the return value of {@link FirebaseMessaging#sendMulticast(MulticastMessage)}
* corresponds to the order of tokens followed by the order of FIDs as they were added to the
* {@link MulticastMessage.Builder}. If both tokens and FIDs are provided, tokens are
* processed first, followed by FIDs.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Such statement is included at the end as "If both tokens and FIDs are provided, tokens are processed first, followed by FIDs."

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

Labels

release:stage Stage a release candidate release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant