Expo Notification undefined is not a function
Please make our job easier by filling this template out to completion. If you're requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.
Description
this error msg TypeError: undefined is not a function appear when run this code let token = await Notifications.getExpoPushTokenAsync();
Expected Behavior
What action did you perform, and what did you expect to happen?
to get the push token
Observed Behavior
What actually happened when you performed the above actions?
6:45:13 PM: Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not a function (evaluating '_expo.Notifications.getExpoPushTokenAsync()')
Environment
Please run these commands in the project folder and fill in their results:
"sdkVersion": "18.0.0",
Also specify:
- Operating system: elementary OS 0.4.1 Loki
- Phone & version: Android Lolipop
For other people who landed here googling this error, I think the problem is that the function is correctly called getExponentPushTokenAsync instead of getExpoPushTokenAsync like the example given in the documentation.
in sdk22 and higher it is getExpoPushTokenAsync: https://github.com/expo/expo-sdk/blob/6ea86aa8415f42a3991e193d7e379d1fc90b7246/src/Notifications.js#L127-L130
Thanks @brentvatne, that makes a lot more sense. I appreciate all the expo work you do. It's helped me tremendously and you're awesome.
hello, I am quite new to react native and I am facing the same issue. @brynnb can you please guide me on how did u actually resolved this push notification error and what is the endpoint I am missing upon?
Apologies @kanikas24, been a long time since I did this and I don't recall more than what I posted above.