Skip to content

Conversation

adamfellon
Copy link

When converting to v6 the key used when registering a headless task needs to be changes to in order to register the correct task.

Summary

Want to represent this comment for users who encounter headless task issues: #2412 (comment)

Checklist

  • Supports Android

When converting to v6 the key used when registering a headless task needs to be changes to in order to register the correct task.
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2019

CLA assistant check
All committers have signed the CLA.

@mikehardy
Copy link
Collaborator

CI seems to have had a major, unrelated failure @Salakar ?

@mikehardy mikehardy added the Workflow: Needs Review Pending feedback or review from a maintainer. label Nov 1, 2019
@Salakar
Copy link
Contributor

Salakar commented Nov 2, 2019

CI seems to have had a major, unrelated failure @Salakar ?

Its just incorrectly not ignoring the docs branch, have updated to branch rules so shouldn't do it again.


Generally ok with this change but really AppRegistry.registerHeadlessTask shouldn't be called manually on v6. This is automatically done for you if you use messaging().setBackgroundMessageHandler(fn) - right now this is all it does internally - but moving it into the API gives us the flexibility in future to change it or further augment the API with minimal effort for users + it also matches the Firebase Web SDK API.

Would you be able to update this to mention calling that method instead? As with the headless task API; it should be called early on in your apps code.


image

@adamfellon
Copy link
Author

Ah, yeah I think I should even be calling that function in my code as well as it'll avoid any issues with renaming in the future.

I don't use Typescript so I think I missed the example from the interface.

I don't know how constants/statics from the NativeModules work but is it worth it to go as far as exporting private static final String TASK_KEY = "ReactNativeFirebaseMessagingHeadlessTask"; out to be used in lib/index.js when it registers the headless task?

@Salakar Salakar added Type: Docs plugin: messaging FCM only - ( messaging() ) - do not use for Notifications labels Mar 25, 2020
@Salakar
Copy link
Contributor

Salakar commented Mar 25, 2020

Superseded by #3339 and friends - thanks!

@Salakar Salakar added this to the v6.4.0 milestone Mar 25, 2020
@Salakar Salakar changed the title Make sure Cloud Messaging changes are represented docs(messaging): note headless task key change in release notes Mar 25, 2020
@Salakar
Copy link
Contributor

Salakar commented Mar 27, 2020

Closing as #3339 which supersedes this has now been merged and is available on an RC release (6.4.0-rc4).

Thank you for your contribution

@Salakar Salakar closed this Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: messaging FCM only - ( messaging() ) - do not use for Notifications Workflow: Waiting for User Response Blocked waiting for user response.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants