expo-horizon-notifications
v55.0.0
Published
A fork of [`expo-notifications`](https://github.com/expo/expo/tree/main/packages/expo-notifications) that provides two implementations: - The default `expo-notifications` for Android and iOS platforms. - A Meta Horizon-compatible implementation that uses
Readme
expo-horizon-notifications
A fork of expo-notifications that provides two implementations:
- The default
expo-notificationsfor Android and iOS platforms. - A Meta Horizon–compatible implementation that uses the Meta's push notification service.
You can choose which implementation to use with the quest / mobile build variants. See expo-horizon-core for more details. This makes it compatible with Meta Horizon devices, while remaining a drop-in replacement for expo-notifications on Android and iOS.
Prerequisites
- Expo SDK 54 or later (
expopackage version 54.0.13+) expo-horizon-corepackage installed. See expo-horizon-core for more details
Usage
- Install and configure the
expo-horizon-corepackage:
npx expo install expo-horizon-coreFor detailed setup steps and configuration options, refer to the expo-horizon-core documentation.
[!NOTE] For push notifications to work, you must set the correct
horizonAppIdin theexpo-horizon-coreconfiguration.
- Install the package:
npx expo install expo-horizon-notifications
# and remove the old package:
npm uninstall expo-notifications
# or
yarn remove expo-notifications- Update your
app.json/app.config.jsto replaceexpo-notificationswithexpo-horizon-notifications. - Use the
questDebug/questReleasebuild variants to run the app on Meta Quest devices. See expo-horizon-core for more details. - Update your imports:
// import * as Notifications from 'expo-notifications';
import * as Notifications from 'expo-horizon-notifications';Push Notifications
- To enable push notifications, first set the
horizonAppIdin yourexpo-horizon-coreconfiguration (see expo-horizon-core for more details). - Use
getDevicePushTokenAsyncto obtain the device's push token. The returned token will have a new type,horizon. - Send this push token to your server, which will use it to deliver push notifications to the device.
- For additional details, refer to the official Horizon OS documentation.
Behavior
- On Meta Quest devices → Uses the Meta Horizon–compatible push notification service.
- On standard Android devices → Falls back to the default
expo-notificationsbehavior using Firebase Cloud Messaging. - On iOS it should have no effect; behavior is always the same as
expo-notifications.
[!IMPORTANT] The
questbuild variants are intended specifically for Meta Quest devices. Using them on standard Android devices is not recommended, as certain features may be unsupported or behave differently.
Additional features
You might need additional features like isHorizonDevice or isHorizonBuild to check if the device is a Meta Horizon device. See expo-horizon-core for more details.
Features supported on Meta Horizon OS
| Function Name | Horizon OS | Notes | Requirements |
| -------------------------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------- | -------------- |
| addPushTokenListener | ✅ Supported (v0.0.11+) | Supported, but still in the testing phase. | horizonAppId |
| getDevicePushTokenAsync | ✅ Supported (v0.0.11+) | Supported, but still in the testing phase. | horizonAppId |
| getExpoPushTokenAsync | ❌ Not supported | Currently, support for the Expo Push Service is not planned. | |
| addNotificationReceivedListener addNotificationResponseReceivedListener | ✅ Supported | | |
| addNotificationsDroppedListener useLastNotificationResponse | ✅ Supported | | |
| setNotificationHandler | ✅ Supported | | |
| registerTaskAsync unregisterTaskAsync | ✅ Supported | | |
| getPermissionsAsync requestPermissionsAsync | ✅ Supported | | |
| getBadgeCountAsync setBadgeCountAsync | ❌ Not supported | The underlying library does not support this functionality. | |
| cancelAllScheduledNotificationsAsync cancelScheduledNotificationAsync | ✅ Supported | | |
| getAllScheduledNotificationsAsync | ✅ Supported | | |
| getNextTriggerDateAsync | ✅ Supported | | |
| scheduleNotificationAsync | ✅ Supported | | |
| dismissAllNotificationsAsync dismissNotificationAsync | ✅ Supported | | |
| getPresentedNotificationsAsync | ✅ Supported | | |
| Manage notification channels | 🔍 Not tested yet | | |
| Manage notification categories (interactive notifications) | 🔍 Not tested yet | | |
| clearLastNotificationResponse clearLastNotificationResponseAsync | ✅ Supported | | |
| getLastNotificationResponse getLastNotificationResponseAsync | ✅ Supported | | |
| unregisterForNotificationsAsync | ❌ Not supported | | |
Version compatibility
Our goal is to align the version numbers of expo-horizon-notifications and expo-notifications for easier upgrades. However, since this fork is still under development, we are currently using a separate versioning scheme.
| expo-horizon-notifications | expo-notifications | Expo SDK Version |
| ---------------------------- | -------------------- | ---------------- |
| 55.0.0 | 55.0.10 | 55 |
| 0.0.9-0.0.11 | 19.0.7 | 54 |
Expo Horizon Notifications is created by Software Mansion
Since 2012 Software Mansion is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – Hire us.
Made by @software-mansion and community 💛
