October 25, 2024
Chicago 12, Melborne City, USA
Android

FCM background notifications receiving for first time only when the app loads – Android 14


I’m just receiving a background notification when I open the app and return it back to the background state, no notifications are receiving in the background after that on Android 14. Notifications are working as expected till Android 13.

Below is the code for background listener in index.js file:

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import messaging from '@react-native-firebase/messaging';


messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Notification for Background:', remoteMessage);
});

AppRegistry.registerComponent(appName, () => App);

I also have the POST_NOTIFICATIONS permission in the manifest file.

Any help would be greatly appreciated.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video