getPresentedNotificationsAsync function is not working in expo notification

Please provide the following:

  1. SDK Version: 36.0.0
  2. Platforms(Android):

When i try to use getPresentedNotificationsAsync() method in expo notification I am getting this error.

code:

Reproducible Demo

import * as Notifications from ‘expo-notifications’
getPushNotificationsAsync = async () => {
let notification = Notifications.getPresentedNotificationsAsync()
console.log(‘notification in Live chat’, notification)
}

I looked in the documentation the function exists but when i try to use in my project i am getting error


[Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘_NotificationPresenterModule.default.getPresentedNotificationsAsync’)]

Hey @arveen12345,

Can you make sure that you’ve added the useNextNotificationsApi field to your app.json? https://docs.expo.io/versions/v38.0.0/sdk/notifications/#android

Cheers,
Adam

@adamjnav yes i have included but still I am getting error

Here is my package.json file

I am using expo sdk version 36.0.0

You need to be using SDK38 to make use of the new Notifications module which is the one that has that method included. The LegacyNotifications module does not.

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