Notifications.getExpoPushTokenAsync is failing

Hi, I’m following the react-native advance course and trying to get push notifications to work. I keep getting and error every time I try to get a push notification token from expo on both android and iOS. I’m new to using react and expo, so I’m not sure what am I missing. The error is “Error getting a push token [TypeError: undefined is not an object (evaluating ‘_expoNotifications.default.getExpoPushTokenAsync’)]” which is console output from the catch, implying the call to const token = await Notifications.getExpoPushTokenAsync(); is failing.

I made sure to register an expo account and logged into the expo-cli. What else do I need to do to successfully get a push token in my local development setup? Thanks.

I figured it out, seem the notification library was updated and required a slight syntax modification.

1 Like

Stuck on this, could you please share this slightly modified syntax?

The expo notification package has several updates available. I ran into the same issue but fixed it when I read the documentary. Just check expo-push notifications online

As of the time of recording, I think the notifications was still part of the bare expo-package. Try to use import * as Notifications from 'expo-notifications'; and obviously run expo install expo-notifications