Course Dashboard

Understanding Notifications in Mobile Apps

Notifications are one of the most powerful communication tools in modern mobile development. They bridge the gap between your application and the user, even when the app is not actively running. In this guide, we will explore the core concepts, different types of notifications, and the fundamental differences between Android and iOS.


Why Use Notifications?

Simply put, notifications are messages sent by an app to alert the user about a specific event. Their importance lies in:

  • Driving Engagement: Studies show that apps using notifications intelligently have up to 4x higher user retention rates.
  • Real-time Alerts: Notifying users about new messages, order updates, or important reminders.
  • Background Updates: Keeping the app's data synchronized without requiring manual user action.

[!IMPORTANT] With great power comes great responsibility. Annoying or irrelevant notifications are the #1 reason for app uninstalls. Balance is key.


Types of Notifications

Notifications can be categorized into three main types based on their source and behavior:

1. Local Notifications

Generated and scheduled from within the app itself on the user's device.

  • Source: Directly from the app's code.
  • Connectivity: Does not require an internet connection or an external server.
  • Use Cases: Alarms, task reminders, or scheduled alerts based on local user input.

2. Push Notifications

Sent from an external server (Back-end) to the user's device.

  • Source: App server via services like Google's FCM or Apple's APNs.
  • Connectivity: Requires an active internet connection.
  • Use Cases: Chat messages, breaking news, or live order tracking.

3. Silent Notifications

Notifications that reach the device but do not display anything to the user (no sound or text).

  • Purpose: To trigger a background task, such as fetching new data, without interrupting the user.

Android vs. iOS: Key Differences

While Expo provide a unified API, there are platform-specific behaviors you must consider:

FeatureAndroidiOS
Notification ChannelsMandatory (allowed granular user control)Not present (controlled globally or via categories)
Status Bar IconsSmall icons appear in the status barNo icons (only visible in the Notification Center)
CustomizationHigh flexibility in sound, vibration, and colorsStricter guidelines for a consistent user experience
PermissionsVaries by OS version (recently became opt-in)Always required explicit user consent

Getting Started with Expo

To handle notifications in an Expo project, we use the official expo-notifications library.

Installation

In your project directory, run:

App.jsbash
npx expo install expo-notifications

Configuration

Ensure your app.json (or app.config.js) includes the necessary configurations, especially for production builds and store submission.


Your First Challenge

Before moving to the next lesson, look at 3 apps you use daily. Can you guess if they use Local notifications (like an alarm) or Push notifications (like WhatsApp)? How do these alerts influence your decision to open the app?