Menu

1 / 2

My first Expo push notifications: device tokens, Expo tokens, APNs and where EAS fits

DEV Community: reactnative·Andy Yeung·13 days ago
#UuxJwAAB
#devtoreactnative#devto#dev#expo#push
Reading 0:00
15s threshold

Background

I assumed a push notification went from one phone straight to another. I also thought it was an EAS service that would eat my free quota. When the build asked "Set up Push Notifications?", I wasn't even sure whether to say yes.

What I tried

Thinking phones send to each other : a phone never connects directly to another phone.

Thinking Expo and EAS were the same thing : the names get used interchangeably, so I assumed pushes counted against EAS quotas.

Treating APNs as a certificate : half right, but I didn't know who actually checks it.

How I did it

1. Tell the two tokens apart

Device token : issued by Apple and tied to "this phone and this app". It's the phone's address on Apple's side.

Expo push token : looks like ExponentPushToken[...] . Expo wraps the device token and gives you this instead. iOS and Android use the same format, so the backend doesn't need two code paths.

Once the user allows notifications, the app gets its Expo push token and sends it to the backend to store.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.