🔥 [🐛] Bug Report Title - No task registered for key ReactNativeFirebaseMessagingHeadlessTask
Issue
I'm currently using Expo v49 with firebase cloud messaging API V1 but can't put background push notifications working on the quitted state for Android.
We have two situations for setBackgroundMessageHandler to trigger on Android:
- When the app is idle in the background. ✅
- When the app is quitted. 🚫 .
The first one works properly, but the last one does not work. It gives me this error: No task registered for key ReactNativeFirebaseMessagingHeadlessTask
Can you help me please?
Project Files
Javascript
Click To Expand
_layout.tsx:
// Imports...
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
displayNotification(remoteMessage);
});
export default function Root() {
return (
<FirstComponentToRender />
);
}
Environment
Click To Expand
react-native info output:
OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- [ ] iOS
- [x] Android
- [ ] iOS but have not tested behavior on Android
- [ ] Android but have not tested behavior on iOS
- [ ] Both
- `@react-native-firebase/messaging version you're using that has this issue:
18.7.3
- Are you using
TypeScript?Yes - 5.1.3
- 👉 Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
I am having the same issue on android
i have same issue on android
same
Same
I suspect that this has something to do with expo router and the startup sequence. https://github.com/expo/expo/issues/29757
Is anyone here also using the file based router of expo and has the issue?
same problem here. [email protected] [email protected] ├─ @react-native-firebase/[email protected] ├─ @react-native-firebase/[email protected]
function HeadlessCheck
({ isHeadless }) {
if (isHeadless) {
// App has been launched in the background by iOS, ignore
return null;
}
// Render the app component on foreground launch
return <RootLayout />;
}
// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log(TAG, 'Message handled in the background!', remoteMessage);
});
registerRootComponent(HeadlessCheck)
export default HeadlessCheck
Also do not work in Android quited app.
When fcm received:
// WARN No task registered for key ReactNativeFirebaseMessagingHeadlessTask
It would be a big problem for us.
same
same
same problem flease fix this
i am facing same issue.
Has anyone fixed this error?
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
it it still there
Has anyone fixed this error?
hey you fixed this or not!!
same
same issue
For me, it only worked this way: only after I placed everything in the root of the app. If you put it inside a hook, you'll get this warning.
For me, it only worked this way: only after I placed everything in the root of the app. If you put it inside a hook, you'll get this warning.
With or without expo file based routing?
For me, it only worked this way: only after I placed everything in the root of the app. If you put it inside a hook, you'll get this warning.
With or without expo file based routing?
I've been using React Native for almost 7 years and have never used Expo.
same issue