Back to React Native tutorials
Advanced17 min read

Push Notifications

Implement push notifications with FCM, APNs, Expo Notifications, and deep link handling.

Permissions and Tokens

Request notification permissions after explaining value—iOS requires explicit grant. Register device tokens with your backend on login and refresh.

FCM handles Android delivery; APNs handles iOS. Unified services like Expo push API abstract both with server-side send endpoints.

Store tokens per device; users may have phone and tablet concurrently.

  • Handle permission denied gracefully with settings deep link
  • Rotate tokens when app reinstalls
  • Never send secrets in notification payloads
import * as Notifications from 'expo-notifications';

const { status } = await Notifications.requestPermissionsAsync();
const token = (await Notifications.getExpoPushTokenAsync()).data;

Handling Notifications

Foreground notifications need local presentation config. Background taps navigate via listeners reading notification data payload.

Categories and action buttons on iOS require native setup. Silent pushes wake app for background fetch within OS limits.

Deep link from notification data into relevant screens and mark content read server-side.

  • Test kill state, background, and foreground tap paths
  • Respect user notification preferences per channel
  • Monitor delivery failures and token invalidation webhooks
Notifications.addNotificationResponseReceivedListener(response => {
  const id = response.notification.request.content.data.orderId;
  navigation.navigate('OrderDetails', { id });
});

Server Integration

Backend schedules pushes on events: order shipped, message received. Batch sends respect provider rate limits.

Personalize with user locale and timezone quiet hours. Track open rates ethically without invasive tracking.

For Expo, POST to https://exp.host/--/api/v2/push/send with access token auth from secure server—not mobile client.

  • Queue notifications with retries and dead letter handling
  • Segment topics for marketing versus transactional pushes
  • Comply with platform policies on promotional content

Get In Touch


Ready to discuss your next project? Drop me a message.