I am using the react-native-firebase library.
On iOS, I am able to receive notifications in the foreground, background and also when the app is in quit state. Handlers work in every scenario too, except for one.
My only problem is: setBackgroundMessageHandler is not being invoked when the app is in quit state, even though I am receiving the notification. I also tried to send data-only messages but the result was the same.
I am even able to invoke the app in a headless state using content-available: 1 in the message's apns section.
But still the setBackgroundMessageHandler is not getting invoked. This is my index.js page:
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('HEADLESS BACKGROUND: ' + ' | ' + JSON.stringify(remoteMessage));
});
function HeadlessCheck({ isHeadless }) {
if (isHeadless) {
console.log("Headless");
// App has been launched in the background by iOS, ignore
return null;
}
return <App />;
}
AppRegistry.registerComponent(appName, () => HeadlessCheck);