Thuta Learning
AdvancedMobile Developmentintermediate

Push Notifications Basics

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Push Notifications Basics without the intimidation factor
  • Write the code yourself and run it on Expo Go
  • Apply this concept immediately in a real app project

Let's think about it this way for a second

The high-level push notification workflow: (1) the app requests permission, (2) it obtains a unique device 'push token', (3) that push token is sent to and stored on a backend server, (4) when some event happens (a message arrives, an order is confirmed), the backend uses the push token to send a notification through a push service like Expo/FCM/APNs. It's important to distinguish local notifications (scheduled by the device itself) from remote/push notifications (triggered by the server).

Let's connect this to a real-world scenario

Install expo-notifications and call Notifications.requestPermissionsAsync() — a permission dialog appears, and once granted, Notifications.getExpoPushTokenAsync() gives you a unique token — this token needs to be stored in a backend database, tied to the user record. Local notifications (e.g. reminders) don't need a backend at all — you can schedule them right on the device with Notifications.scheduleNotificationAsync().

Code Example

javascript
import * as Notifications from 'expo-notifications';

async function registerForPushNotifications() {
  const { status } = await Notifications.requestPermissionsAsync();
  if (status !== 'granted') return null;

  const tokenData = await Notifications.getExpoPushTokenAsync();
  return tokenData.data; // send this to your backend to store
}

// Local notification example (no backend needed)
await Notifications.scheduleNotificationAsync({
  content: { title: 'Reminder', body: 'Practice React Native today!' },
  trigger: { seconds: 60 },
});
You should see
Once permission is granted, you get a push token string, and a local notification triggers after 60 seconds.

Try it in 5 minutes

Install expo-notifications and schedule a local notification (scheduleNotificationAsync) yourself (on Expo Go).

A quick word of caution

If you request push notification permission the moment the app opens, users tend to deny it more often — requesting it contextually, at the moment the feature is actually used (e.g. the first time the chat feature is used), gets a better accept rate.

Easy traps

  • Thinking there's no need to store the push token in a backend database — sending remote push requires the backend to know the token
  • Confusing local vs. push notifications and overcomplicating the backend architecture design

Now try it yourself

Install expo-notifications and schedule a local notification (scheduleNotificationAsync) yourself (on Expo Go).

You'll know it worked when: Once permission is granted, you get a push token string, and a local notification triggers after 60 seconds.

Push Notifications Basics | Thuta Learning