Skip to content

FCM V1 API Migration initial commit.#8087

Open
eldhosembabu wants to merge 6 commits into
mainfrom
emb/fcm-v1-reg
Open

FCM V1 API Migration initial commit.#8087
eldhosembabu wants to merge 6 commits into
mainfrom
emb/fcm-v1-reg

Conversation

@eldhosembabu
Copy link
Copy Markdown
Contributor

FCM V1 API Migration initial commit.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject firebase-messaging:
error: Added method com.google.firebase.messaging.FirebaseMessaging.register() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessaging.unregister() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onRegistered(String) [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onUnregistered(String) [AddedMethod]
error: Added class com.google.firebase.messaging.GmsRegistrationClient [AddedClass]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject firebase-messaging:
error: Added method com.google.firebase.messaging.FirebaseMessaging.register() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessaging.unregister() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onRegistered(String) [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onUnregistered(String) [AddedMethod]
error: Added class com.google.firebase.messaging.GmsRegistrationClient [AddedClass]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

1 similar comment
@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject firebase-messaging:
error: Added method com.google.firebase.messaging.FirebaseMessaging.register() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessaging.unregister() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onRegistered(String) [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onUnregistered(String) [AddedMethod]
error: Added class com.google.firebase.messaging.GmsRegistrationClient [AddedClass]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

// onNewToken() is only invoked for the default app as there is no parameter to identify which
// app the token is for. We could add a new method onNewToken(FirebaseApp app, String token) or
// the like to handle multiple apps better.
if (FirebaseApp.DEFAULT_APP_NAME.equals(firebaseApp.getName())) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: we could reduce the nesting by

if (!FirebaseApp.DEFAULT_APP_NAME.equals(firebaseApp.getName())) {
  return;
}

Comment on lines +866 to +870
if (isUnregistered) {
messagingIntent.setAction(FirebaseMessagingService.ACTION_FCM_UNREGISTERED);
} else {
messagingIntent.setAction(FirebaseMessagingService.ACTION_FCM_REGISTERED);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: this can be simplified to one line: messagingIntent.setAction(isUnregistered ? ... : ...)


// For V1 registration, the token received should be the same as the FID.
if (!TextUtils.isEmpty(registrationToken)
&& registrationToken.contains(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.

nit: endWith may be better than contains?

} else {
taskCompletionSource.setException(
new ExecutionException(
new IllegalArgumentException("FID not matching with received token!")));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This error message could be confusing to developers. We should avoid using the term "token". Maybe consider a generic error message such as "Unexpected error occurred" or "Internal error occurred".

}

@Test
public void testRegister_throwsWhenV1Disabled() throws Exception {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shall we add more unit tests for testRegister and testUnregister for the success cases? For example,

  1. A call to register()/unregister() will always invoke onRegistered()/onUnregistered().
  2. When FIS returns a different FID, a call to register() should bypass the cache and re-register with the backend.

We can also add some tests for the auto-init enabled/disabled behaviors when firebase_messaging_insatllation_id_enabled = true.

@google-oss-bot
Copy link
Copy Markdown
Collaborator

The public api surface has changed for the subproject firebase-messaging:
error: Added method com.google.firebase.messaging.FirebaseMessaging.register() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessaging.unregister() [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onRegistered(String) [AddedMethod]
error: Added method com.google.firebase.messaging.FirebaseMessagingService.onUnregistered(String) [AddedMethod]
error: Added class com.google.firebase.messaging.GmsRegistrationClient [AddedClass]

Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants