Skip to main content

Overview

Push notifications allow you to engage users even when your app isn’t running. Expo provides expo-notifications to handle both local and remote notifications across iOS and Android.

Installation

1

Install the package

2

Configure your app.json

Add notification configuration to your app.json:
app.json
3

Request permissions

Create a hook to manage notification permissions:
hooks/useNotifications.ts

Handling Notifications

Configure notification behavior

Set how notifications are displayed when the app is foregrounded:
App.tsx

Listen for notifications

Sending Notifications

Local notifications

Push notifications from your server

Platform-Specific Setup

Apple Push Notification Service

1

Create an APNs key

  1. Go to Apple Developer Portal
  2. Create a new key with Push Notifications enabled
  3. Download the .p8 file
2

Upload to Expo

Select your iOS app and upload the APNs key.
3

Enable push notifications capability

In your app.json:

Notification Channels (Android)

Android 8.0+ requires notification channels:

Testing Notifications

Test with Expo push tool

Use the Expo Push Notification Tool to send test notifications:
  1. Get your Expo push token from your app
  2. Enter it in the tool
  3. Compose and send a test notification

Test locally

Troubleshooting

  • Ensure you’re testing on a physical device (not simulator)
  • Check that APNs credentials are correctly configured
  • Verify push notifications capability is enabled
  • Check that your app is properly signed
Make sure you’ve set up the notification handler:
  • Verify you’re using a physical device
  • Check that all permissions are granted
  • For iOS: Ensure APNs is properly configured
  • For Android: Verify google-services.json is present
  • Ensure the sound file is in the correct format (WAV or MP3)
  • Add the sound file to your assets and reference it in app.json
  • For Android, set up the notification channel with the sound
Push notifications require physical devices for testing. The iOS simulator and some Android emulators don’t support push notifications.

Best Practices

  • Request permission contextually: Ask for notification permissions when the user takes an action that benefits from notifications
  • Use notification channels: Create separate channels for different types of notifications on Android
  • Include deep links: Add data to notifications to navigate users to relevant content
  • Handle notification lifecycle: Listen for notifications in all app states (foreground, background, quit)
  • Test thoroughly: Test on both iOS and Android physical devices
  • Store tokens securely: Send push tokens to your backend and associate them with user accounts
  • Handle token refresh: Listen for token updates and update your backend
  • Badge management: Clear badges when appropriate using Notifications.setBadgeCountAsync(0)