Skip to main content
Configure Firebase and deep linking to receive, display, and handle Userpilot push notifications on Android. The Userpilot SDK supports push notifications to help you deliver targeted messages and enhance user engagement.

Notification taps while offline

In SDK 1.4.0 and later, a valid notification tap for the current user routes its deep link without waiting for an open analytics connection. The SDK records the open at tap time and persists it when the device is offline. Test notifications navigate without recording a push-open analytics event. The destination may still need a network connection to load its content. See Navigation callbacks for startup routing and Offline Mode for storage and delivery limits.

Prerequisites

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, refer to the Android Push Notification Guide.

Setup

This guide assumes this is the first time you’re adding push notification code to your project using Google services (Firebase Cloud Messaging). If 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 to display push notifications. The Userpilot SDK automatically requests push notifications permission on its own. Step 3. Add the Userpilot Firebase Messaging Service Firebase connects to your app through a <service>. Add the following to your AndroidManifest.xml:
If your project already has 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 in Manifest.xml . This configuration enables deep linking based on a custom scheme defined in your app. Define the deep-link scheme. Use userpilot- followed by the lowercased token passed to the SDK, including stg- for staging tokens. For example, NX-12345678 uses userpilot-nx-12345678. Leave userpilot_custom_scheme empty to use this default. If you set a custom value, register the same value in the manifest. See Custom URL scheme for the complete setup. Update Manifest file to include the intent-filter as below. Make sure to set host="sdk" .
Step 5. Handling Notification Intent Inside your entry point activity, pass the intent to the Userpilot SDK to handle it.
Step 6. Customization The Userpilot SDK allows customization for how messages are delivered. These properties are set as <resources> values. To change them, create a file under res/values and set the desired values.