Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃摎] FCM client for Flutter #12676

Open
SamBeNuts opened this issue Apr 20, 2024 · 0 comments
Open

[馃摎] FCM client for Flutter #12676

SamBeNuts opened this issue Apr 20, 2024 · 0 comments
Labels
good first issue Good for newcomers platform: all Issues / PRs which are for all platforms. plugin: messaging type: documentation Improvements or additions to documentation

Comments

@SamBeNuts
Copy link

Hi, while onboarding my Flutter app with FCM, I noticed multiple behaviors that differ from what it's written in the documentation. Note that I only tested with iOS so things might behave differently on Android (which would be annoying as I'm expecting Flutter to act the same whatever the platform is).

To retrieve the current registration token for an app instance, call getToken(). If notification permission has not been granted, this method will ask the user for notification permissions. Otherwise, it returns a token or rejects the future due to an error.
Sources: https://firebase.google.com/docs/cloud-messaging/flutter/client#access_the_registration_token and https://firebase.google.com/docs/cloud-messaging/flutter/first-message#access_the_registration_token

Calling getToken() never asks for permission, even on first launch when the authorizationStatus is obviously notDetermined. After checking the code nothing seems to request permission so maybe the doc is just not up-to-date.

FirebaseMessaging.instance.onTokenRefresh.listen((fcmToken) {
// Note: This callback is fired at each app startup and whenever a new token is generated.
})
Source: https://firebase.google.com/docs/cloud-messaging/flutter/client#access_the_registration_token

This callback is never called on app startup. In my opinion, it makes sense to not fire an event if token didn't change since last startup but while testing it was not even triggered on first app launch.

For apple platforms, ensure the APNS token is available before making any FCM plugin API calls
Source: https://firebase.google.com/docs/cloud-messaging/flutter/client#access_the_registration_token

From my understanding, FCM needs to register the APNS token in order to map it to the registration token so any calls before that would fail. I think it would be better to explain that in the documentation with more details around the cases when the APNS token might be null and what to do in this situation. On the latter, would you recommend to retry with an exponential backoff?

Please have a look and update the doc accordingly.

@SamBeNuts SamBeNuts added good first issue Good for newcomers type: documentation Improvements or additions to documentation labels Apr 20, 2024
@Lyokone Lyokone added the platform: all Issues / PRs which are for all platforms. label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers platform: all Issues / PRs which are for all platforms. plugin: messaging type: documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants