Notifee Documentation

repository·main·Indexed 24 days ago

https://github.com/invertase/notifee

A feature-rich notifications library for React Native providing advanced Android and iOS capabilities, including foreground services, rich styling, interactive actions, and trigger-based scheduling. Note that the project is no longer actively maintained; users are encouraged to migrate to expo-notifications or react-native-notify-kit.

Tokens
58.4K
Snippets
131
Records
317
Agent score
78%

What's inside Notifee

  1. Overview of Android Notification features in Notifee

    main

    Notifee provides an interface to the expansive Android Notification API, supporting rich, styled, and interactive notifications. It is designed to integrate with the latest Android API features while maintaining backwards compatibility for older devices, specifically dating back to Android 4.4W (API 20).

    Key areas for customizing Android notifications include:

    • Appearance: Icons, colors, and visibility.
    • Behaviour: Sound, vibration, and lights.
    • Channels & Groups: Organizing notifications so users can control how they are handled.
    • Foreground Service: Displaying ongoing, prominent notifications for long-running background tasks.
    • Grouping & Sorting: Managing related notifications in the notification pane.
    • Interaction: Implementing user actions directly from the notification.
    • Permissions: Checking notification status for the app, channel groups, or specific channels.
    • Progress Indicators: Showing progress for ongoing background tasks.
    • Styles: Using expandable images, text, or message conversations.
    • Timers: Displaying counting timers for ongoing tasks like phone calls or remaining event time.
  2. Overview of iOS Notification features in Notifee

    main

    Notifee supports devices running iOS 10+ and provides an interface for the native iOS API to create interactive notifications. Key feature areas include:

    • Appearance: Customizing how notifications are displayed.
    • Badges: Managing the application icon badge count.
    • Behaviour: Controlling notification behavior during display.
    • Categories & Actions: Creating and assigning categories to enable notification actions.
    • Interaction: Handling user interactions and quick actions.
    • Permissions: Requesting user permission to display notifications.
    • Remote Notification Support: Integrating Notifee with remote notifications.
  3. What is Notifee?

    main
    Notifee is a local notifications library for React Native that provides support for both Android and iOS applications. Unlike many other notification libraries, it does not integrate with 3rd party messaging services (like Firebase Cloud Messaging), giving developers full flexibility over how notifications are managed and integrated into their existing applications.
  4. Overview of Notifee features for Android and iOS

    main

    Notifee is a feature-rich notifications library for React Native that provides advanced capabilities for both Android and iOS.

    Android Capabilities

    • Appearance: Customize icons, colors, and visibility.
    • Behaviour: Control sound, vibration, and lights.
    • Channels & Groups: Organize notifications into channels and groups for user control.
    • Foreground Service: Use prominent notifications for long-running background tasks.
    • Grouping & Sorting: Manage related notifications in the notification pane.
    • Interaction: Implement user actions directly from notifications.
    • Progress Indicators: Show and update progress for ongoing tasks.
    • Styles: Use rich content like expandable images, text, or message conversations.
    • Timers: Display counting timers for tasks like phone calls or remaining event time.

    iOS Capabilities

    • Appearance: Customize notification display.
    • Behaviour: Control sound and critical alerts.
    • Categories: Create and assign categories to notifications.
    • Interaction: Handle user interactions with notifications.
    • Permissions: Request user permission to display notifications.
  5. Customize iOS notification summary text

    main

    When iOS stacks (groups) multiple unread notifications from your app, the top notification displays summary text. You can override the default iOS summary text by using a combination of:

    1. Providing summaryArgument and summaryArgumentCount fields in the notification body.
    2. Defining a summaryFormat within an iOS Category.

    Note: This functionality requires iOS 12 or higher.

  6. Use notification categories and summary arguments on iOS

    main

    To implement advanced notification grouping and custom actions on iOS:

    1. Categories: Use categoryId to link a notification to a registered IOSCategory (created via setNotificationCategories).
    2. Summary Arguments: For notifications that represent a collection of items (like multiple messages in a chat), use summaryArgument (e.g., the group name) and summaryArgumentCount (the number of items) to populate the IOSCategory.summaryFormat (requires iOS >= 12).
    3. Threading: Use threadId to visually group related notifications together.
  7. Configure Android Channels with AndroidChannel

    main

    The AndroidChannel interface is used to describe an Android Notification Channel. Channels are essential for Android notifications as they allow users to control notification preferences (like lights, vibration, and sound) at a category level.

    Important Lifecycle Rules:

    • Immutable Settings: Most properties (e.g., badge, bypassDnd, groupId, importance, lightColor, lights, sound, vibration, vibrationPattern, visibility) cannot be changed once the channel has been created. If you need to change these, you must create a new channel with a different id.
    • Mutable Metadata: Only name and description can be updated after the channel is created.
    • User Control: Channels override individual notification preferences, and the user has the final authority over these settings in the Android system settings.
  8. Use AndroidDefaults to configure legacy Android notifications

    main

    On Android devices that do not support notification channels (API Level < 26), you can use the AndroidDefaults enumeration to override the default alert behavior. You do this by providing an array of defaults to the notification configuration.

    Note: On API Levels >= 26, this enumeration has no effect because notifications follow the behavior defined by the notification channel.

  9. Understand the platform differences in Notifee

    main
    Because the underlying APIs and features for notifications differ significantly between Android and iOS, Notifee documentation and implementation details are often split into platform-specific concepts. When implementing features, you should refer to the specific guides for iOS and Android to ensure correct behavior on each platform.
  10. Understand the EventDetail interface

    main
    The EventDetail interface represents the specific data payload provided alongside a notification event. Depending on the EventType triggered, different properties within EventDetail will be populated. For example, a press event will provide notification and pressAction details, while a channel block event will provide channel details. You should check the EventType of the event before attempting to access these optional properties.