Shawn Mervin

Expo push notifications

Expo's service for sending push notifications, and how Rental Pilot tells field staff about new chats and tasks.

Visit docs.expo.devOn the phone

What it is

Expo push notifications are a hosted service that sits in front of the platform push systems. An app registers for notifications and receives an Expo push token. The server sends a message to Expo's push API with that token, and Expo hands it to Apple Push Notification service on iOS or Firebase Cloud Messaging on Android.

After sending, the server can ask Expo for receipts. A receipt says whether the platform accepted the message, and flags tokens that are no longer valid, for example after an app is deleted, so they can be cleaned up. Expo recommends checking receipts after each send, since a dead token that keeps being used is wasted work for the server.

How I use it

  • Rental Pilot sends chat messages and task assignments to iPhones through Expo's push service to Apple.
  • Delivery was proven on a real device, not just in a simulator.
  • People not connected to the chat server get an Expo push instead of a live message.
  • The chat server reads Expo push receipts and removes dead device tokens.

Expo's push service is the right tool when an app is already built on Expo and the team wants one simple API for notifications instead of handling Apple's credentials and protocols directly. I reach for it so that a field worker who is not looking at the app still hears about a new message or job.

Questions

Will my staff get notifications when the app is closed?

Yes, that is what push is for. In Rental Pilot, chat messages and task assignments reach the phone through Expo's push service to Apple even when the app is not open.

What happens to notifications for old phones?

Rental Pilot's chat server reads Expo push receipts and removes device tokens that are no longer valid, so messages are not sent to phones that have deleted the app.

Working with Expo push notifications?

Tell me what you're building. Start a project or see the whole stack.

Got an operation that's outgrown its spreadsheets?

Tell me what your business does and where it's jamming up. If I'm not the right person for it, I'll say so and point you somewhere better.

What to send, and what happens next