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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] setBackgroundMessageHandler() only working when app loads - Android 14 #8088

Open
3 of 9 tasks
wahas-mughal opened this issue Oct 25, 2024 · 1 comment
Open
3 of 9 tasks
Labels

Comments

@wahas-mughal
Copy link

wahas-mughal commented Oct 25, 2024

setBackgroundMessageHandler() only receives the events when the app starts, after that it does not receive any event whether it's data only or notification enrich event on Android 14, below Android 14 it's working perfectly.

Project Files

I have the following code in index.js

Javascript

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);

Click To Expand

package.json:

{
"name": "trivialapp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"startiPhone14ProMax": "npx react-native run-ios --udid A5B34590-AECD-4452-B840-F486D2F4344B",
"startiPhone11ProMax": "npx react-native run-ios --udid 54617BC6-D808-4ACE-8C9B-B18C6BB50E5F",
"start": "react-native start",
"lint": "eslint .",
"test": "jest"
},
"dependencies": {
"@notifee/react-native": "^9.1.2",
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-community/push-notification-ios": "^1.11.0",
"@react-native-firebase/app": "^14.12.0",
"@react-native-firebase/messaging": "^14.12.0",
"@react-navigation/drawer": "^6.6.3",
"@react-navigation/material-top-tabs": "^6.2.3",
"@react-navigation/native": "^6.0.10",
"@react-navigation/native-stack": "^6.6.2",
"@reduxjs/toolkit": "^1.9.0",
"axios": "^0.27.2",
"deprecated-react-native-prop-types": "^4.2.3",
"lottie-react-native": "^5.1.3",
"moment": "^2.29.4",
"patch-package": "^8.0.0",
"react": "18.2.0",
"react-moment": "^1.1.2",
"react-native": "0.71.14",
"react-native-axios": "^0.17.1",
"react-native-code-push": "^7.1.0",
"react-native-date-picker": "^4.2.5",
"react-native-device-info": "^10.2.1",
"react-native-elements": "^3.4.2",
"react-native-fast-image": "^8.6.0",
"react-native-gesture-handler": "^2.9.0",
"react-native-linear-gradient": "^2.6.2",
"react-native-modal-dropdown": "^1.0.2",
"react-native-modern-datepicker": "^1.0.0-beta.91",
"react-native-pager-view": "6.2.3",
"react-native-paper": "^4.2.0",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^2.17.0",
"react-native-responsive-fontsize": "^0.5.1",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "^4.3.1",
"react-native-screens": "^3.22.1",
"react-native-skeleton-content-nonexpo": "^1.0.13",
"react-native-snap-carousel": "^3.9.1",
"react-native-swiper": "^1.6.0",
"react-native-tab-view": "^3.1.1",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^10.0.1",
"react-native-webview": "^11.23.1",
"react-redux": "^8.0.5"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "7.20.0",
"@react-native-community/eslint-config": "3.2.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^29.2.1",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "29.2.1",
"eslint": "8.19.0",
"jest": "29.1.1",
"metro-react-native-babel-preset": "0.73.10",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"jest": {
"preset": "react-native"
}
}

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • [] I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


@wahas-mughal wahas-mughal changed the title [🐛] Bug Report Title - CHANGE ME [🐛] setBackgroundMessageHandler() only working when app loads Oct 25, 2024
@wahas-mughal wahas-mughal changed the title [🐛] setBackgroundMessageHandler() only working when app loads [🐛] setBackgroundMessageHandler() only working when app loads - Android 14 Oct 25, 2024
@jayan2019
Copy link

I am also facing the same issue, Have you found any solution @wahas-mughal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants