Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

128
Vistas
Firebase background message handler not triggered in react

I am trying to send data to the my app using firebase messaging. I receive the notification, but the background handler is never triggered on the app.

This is how I send the message

     await admin.messaging().sendToDevice(
        usersToken,
        {
            notification: {
                title: title,
                body: body,
                sound : 'default'
            },
            data:{
                test: 'hello',
            }
        },
        {
      // Required for background/quit data-only messages on Android
      priority: 'high',
},
);

And the react code I tried to implement the handler inside and outside the App function, but none worked.

In App.tsx

/**
 * This is the root component of our app.
 */
function App() {

}

 // Register background handler
 messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background!', remoteMessage);
});

AppRegistry.registerComponent('app', () => App);

Second try:

/**
 * This is the root component of our app.
 */
function App() {

 // Register background handler
 messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background!', remoteMessage);
});

AppRegistry.registerComponent('app', () => App);
}

I receive the notification on the device, I get no errors, but the background handler is not triggered.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda