Skip to main content
Userpilot SDK supports handling push notifications to help you deliver targeted messages and enhance user engagement. For Expo apps, setting up Userpilot Push Notifications requires configuration through the Expo Config Plugin. Refer to the official documentation for detailed setup instructions.

AndroidSetup:

Prerequisites It is recommended to configure your Android push settings in the Userpilot Settings Studio before setting up push notifications in your app. To obtain the required keys and configuration details, please refer to the Android Push Notification Guide. Setting up This guide assumes this is the first time code is being added to your project related to setting up push notifications using Google services (Firebase Cloud Messaging). In the case your project is already configured for push, proceed to Step 2. Step 1. Add Firebase Follow the steps in the official Google documentation on How to add Firebase to your project. Step 2. Request Notifications Permission Starting from Android 13 (API level 33), apps **must explicitly request the **POST_NOTIFICATIONS permission in order to display push notifications. The Userpilot ReactNative module automatically requests push notifications permission on its own. Step 3. Add the Userpilot Firebase Messaging Service Firebase connects to your app through a <service> . Go to your Manifest file under example -> android -> app -> manifest and add:
If your project has already added a child of FirebaseMessagingService, you can leave it as is, and instead plug in UserpilotFirebaseMessagingService to your service class.
Step 4. Deep Linking To ensure your app opens automatically when a Userpilot push notification is clicked, you need to configure an intent-filter in your app’s **entry **Activity under example -> android -> app -> manifest . This configuration enables deep linking based on a custom scheme defined in your app. Define the Deep Link Scheme In your userpilot.xml configuration file, you should have defined a value for userpilot_push_notification , check Step 5. Update Manifest file to include the intent-filter as below. Make sure to set host="sdk" .
Step 5. Customizing The Userpilot SDK allows for some customizations that will change how your messages will be delivered to your end users. These properties are set as <resources> properties. In order change those properties create a file under res/values under example -> android -> app and set it to desired values.

iOS Setup

Prerequisites It is recommended to configure your iOS push settings in the Userpilot Settings Studio before setting up push notifications in your app. To obtain the required keys and configuration details, please refer to the iOS Push Notification Guide. Enabling Push Notification Capabilities In Xcode, navigate to the Signing & Capabilities section of your main app target and add the Push Notifications capability. Configuring Push Notifications The Userpilot iOS SDK supports receiving push notification so you can reach your users whenever the moment is right. There are two options for configuring push notification: automatic or manual. Automatic configuration is the quickest and simplest way to configure push notifications and is recommended for most customers. Automatic App Configuration Automatic configuration takes advantage of swizzling to automatically provide the necessary implementations of the required UIApplicationDelegate and UNUserNotificationCenterDelegate methods. To enable automatic configuration, call Userpilot.enableAutomaticPushConfig() from UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:) inside example -> ios -> AppDelegate.swift .
Automatic configuration seamlessly integrates with your app’s existing push notification handling. It processes only Userpilot notifications, while ensuring that all other notifications continue to be handled by your app’s original logic. Manually Configuring Push Notifications Step 1. Enable push capabilities
Step 2. Register for push notifications
Step 3. Set push token for Userpilot
Step 4. Enable push response handling
Step 5. Configure foreground handling
Full source code: