I followed the Notifications guide and registered for push (which shows up in Settings > [My App Name] > Notifications) and am getting an ExponentPushToken[XXXXXXXXXXXXXXXX]
. However, after sending a sample push I don’t receive it (with the app open or closed):
const result = await Notifications.scheduleNotificationAsync({
content: {
title: 'Test',
body: 'This is a test.',
},
trigger: {
seconds: 2,
},
})
I do see that the notification is scheduled with getAllScheduledNotificationsAsync
:
content:
attachments: []
badge: null
body: "This is a test."
categoryIdentifier: ""
data: {}
launchImageName: ""
sound: null
subtitle: null
summaryArgument: ""
summaryArgumentCount: 0
targetContentIdentifier: null
threadIdentifier: ""
title: "Test"
__proto__: Object
identifier: "XXXXXXXXXXXXXXXXXXXXX"
trigger:
class: "UNTimeIntervalNotificationTrigger"
repeats: false
seconds: 2
type: "timeInterval"
__proto__: Object
I have set up eas credentials
for both development
and production
. What’s stranger is that when I send a push with the following cURL, it appears on my phone (but doesn’t get handled in the app):
curl -H "Content-Type: application/json" -X POST "https://exp.host/--/api/v2/push/send" -d '{
"to": "ExponentPushToken[XXXXXXXXXXX]",
"title":"hello",
"body": "world"
}'
{"data":{"status":"ok","id":"XXXXXXXXXXXXXX"}}
I built the app to my iPhone 13 Pro using expo run:ios
.
Expo v44
Version: eas-cli/2.1.0 darwin-x64 node-v14.19.1