I just ran the Snack and it is working for me. Can you let me know what version of iOS your device is running as well as what version of the Expo client you are running?
I’m having the same issue. The snack is setup on my phone, notifications are enabled, but nothing appears and the text doesn’t update where it displays Origin and Data. Any suggestions?
So after a couple of hours trying to get this working, I realised that
const message = {
to: YOUR_PUSH_TOKEN,
sound: 'default',
title: 'Original Title',
body: 'And here is the body!',
data: { data: 'goes here' },
};
Needs to contain to:ExponentPushToken[], for some reason the code doesn’t include that or mention that you cant just pass in the actual token. I guess it would also work to use const YOUR_PUSH_TOKEN = 'ExponentPushToken[ho98SdEpcYgEG8tw5UtUft]'; for example.
However, I chose to use this approach:
const YOUR_PUSH_TOKEN = 'ho98SdEpcYgEG8tw5UtUft';
// code inbetween
const message = {
to: "ExponentPushToken[" + YOUR_PUSH_TOKEN + "]",
sound: 'default',
title: 'Original Title',
body: 'And here is the body!',
data: { data: 'goes here' },
};
Also: this guide helped me figure this out, hopefully it can help other people as well stuck on push notification.