Skip to content

FCM V1 API Migration initial commit.#8087

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

FCM V1 API Migration initial commit.#8087
eldhosembabu wants to merge 12 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.

@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.

@eldhosembabu eldhosembabu requested a review from Doris-Ge May 19, 2026 20:08
@eldhosembabu eldhosembabu requested a review from gsakakihara May 20, 2026 17:59
@Deprecated
@NonNull
public Task<String> getToken() {
if (iid != null) {
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.

Is there a reason for removing the FirebaseInstanceId calls? It's long deprecated, but removing the compatibility when including that SDK is probably a breaking change and would need to be documented.

public Task<String> getToken() {
if (iid != null) {
return iid.getTokenTask();
if (gmsRegistrationClient.isV1RegistrationEnabled()) {
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.

Maybe this could be extracted into a helper?

* Returns whether the existing token is a FID based on its length.
*/
boolean isFid() {
return token.length() <= 22;
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.

Just, checking whether this is actually guaranteed in both cases (FID is always <=22 and FCM token is always > 22)?

# 25.0.2

- [changed] Fix ANR in SharedPreferencesQueue by reducing lock contention
- [feature] Added support for FCM registration using Firebase Installation ID as token
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.

These will need to go in the next release and it will need to be a minor version bump since it's added new APIs (25.1.0).

@@ -0,0 +1,193 @@
// Copyright 2020 Google LLC
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.

2026

import java.util.concurrent.ExecutorService;

/** A client for the CloudMessaging API to make FCM registration calls. */
public class GmsRegistrationClient {
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.

This should be hidden since I don't think you want it as part of the public API (developers shouldn't be using it directly).

executorService.execute(
() -> {
try {
String installationId = Tasks.await(firebaseInstallations.getId());
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.

I think this and other similar calls might be able to use a chain of continuations of the task, something like firebaseInstallations.getId().continueWithTask(...), which might simplify this somewhat.

() -> {
try {
String installationId = Tasks.await(firebaseInstallations.getId());
String registrationToken = Tasks.await(registerOverV1(installationId));
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.

I don't think it makes sense to have registerOverV1 return a Task and then only wait on the result. If it's only being called in a blocking manner, registerOverV1 should probably just be blocking.

executorService.execute(
() -> {
try {
Tasks.await(unregisterOverV1());
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.

Same here, this probably should just be blocking and not return a Task if you're only going to be blocking on the Task.

@@ -0,0 +1,155 @@
// Copyright 2024 Google LLC
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.

2026

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.

4 participants