1. SDK Version: 42
  2. Managed Work Flow

I am building a chat app where I need the NotificationReceivedListener to get called in both the background and foreground but it only runs in the foreground according to the Docs. In SDK 42 there is a new method that runs in the background called “BackgroundNotificationTask” but there is no documentation for it. Anyone knows if it’s possible to handle background notifications even if the user didn’t click on the notification (with each notification I am updating app data whether the app is in the foreground or background).

I am also curious about this topic and trying to implement it. Also curious maybe if the code provided below is the way to go about detecting notifications received in the background?

import * as TaskManager from 'expo-task-manager';
import * as Notifications from 'expo-notifications';


TaskManager.defineTask(BACKGROUND_NOTIFICATION_TASK, ({ data, error, executionInfo }) => {
  console.log('Received a notification in the background!');
  // Do something with the notification data