Handling incoming notifications when the app is not in the foreground

Im trying to test when notification is received while the app is backgrounded, following this documentation

const BACKGROUND_NOTIFICATION_TASK = 'BACKGROUND-NOTIFICATION-TASK';

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

});

Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);

And I doesn’t work !!!

May you guide me how can I make push notification works in backround do I have add priority: ‘max’ in await Notifications.scheduleNotificationAsync because it works only in foreground !!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.