Skip to content

docs(messaging): document the opt-in that register() needs - #18970

Open
BiAksoy wants to merge 1 commit into
firebase:mainfrom
BiAksoy:docs/messaging-register-opt-in
Open

BiAksoy wants to merge 1 commit into
firebase:mainfrom
BiAksoy:docs/messaging-register-opt-in

Conversation

@BiAksoy

@BiAksoy BiAksoy commented Nov 14, 2026

Copy link
Copy Markdown

Description

register() and unregister() fail on Android, iOS and macOS unless the app opts in to registration by Firebase Installation ID. On Android, the opt-in is the firebase_messaging_installation_id_enabled meta-data. On Apple platforms, it is the FirebaseMessagingInstallationIdEnabled key in Info.plist. Once enabled, the deprecated token API (getToken(), deleteToken()) fails instead.

Only the example app shows this today. An app that follows the deprecation messages and moves from getToken() to register() gets, on Android:

java.lang.IllegalStateException: API disabled. Please enable it by adding
{@code <meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" />} to your app's manifest.

This PR documents the settings in the doc comments of register() and unregister(). It also notes on getToken() and deleteToken() that they fail once the setting is on, and adds a short README section next to the UIScene one. The behaviour described follows the native SDKs: FirebaseMessaging.java in firebase-android-sdk, and the installationIdEnabled documentation in firebase-ios-sdk's FIRMessaging.h. It was seen on an Android device with 17.0.1.

Related Issues

Follows #18482 (FID registration APIs, requested in #18479).

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide). Documentation only, no behaviour change.
  • All existing and new tests are passing. Not run: comments and README only.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@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 updates the documentation in the README and Dart files to explain how to register with a Firebase Installation ID (FID) on Android, iOS, and macOS, including the configuration steps and the impact on legacy token APIs. The review feedback suggests improving the clarity and terminology of these documentation updates, such as using more standard phrasing like 'disabled by default' and simplifying global configuration references.

Comment on lines +49 to +50
On Android, iOS and macOS, the native SDKs turn registration by Firebase Installation ID off
by default, and `register()` and `unregister()` fail until the app enables it.

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.

low

Using "disable ... by default" is more standard and idiomatic in technical documentation than "turn ... off by default".

Comment on lines +165 to +166
/// On Android, iOS and macOS, this fails once registration by FID is enabled
/// for [register].

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.

low

The phrasing "enabled for [register]" is slightly awkward because the setting is enabled globally for the application/SDK, not specifically "for" the register method. Simplifying this to "enabled" is clearer.

Suggested change
/// On Android, iOS and macOS, this fails once registration by FID is enabled
/// for [register].
/// On Android, iOS and macOS, this fails once registration by FID is enabled.

Comment on lines +188 to +189
/// On Android, iOS and macOS, registration by FID is turned off by default,
/// and this method fails until the app enables it:

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.

low

Using "disabled by default" is more standard and idiomatic in API documentation than "turned off by default".

Suggested change
/// On Android, iOS and macOS, registration by FID is turned off by default,
/// and this method fails until the app enables it:
/// On Android, iOS and macOS, registration by FID is disabled by default,
/// and this method fails until the app enables it:

Comment on lines +241 to +242
/// On Android, iOS and macOS, this fails once registration by FID is enabled
/// for [register].

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.

low

The phrasing "enabled for [register]" is slightly awkward because the setting is enabled globally for the application/SDK, not specifically "for" the register method. Simplifying this to "enabled" is clearer.

Suggested change
/// On Android, iOS and macOS, this fails once registration by FID is enabled
/// for [register].
/// On Android, iOS and macOS, this fails once registration by FID is enabled.

This branch has not been deployed

No deployments
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.

1 participant