Configure push notifications to receive, display, and handle Userpilot push notifications on iOS and Android.
The Userpilot SDK supports push notifications on both iOS and Android to help you deliver targeted messages and enhance user engagement.
iOS Setup
Prerequisites
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, refer to the iOS Push Notification Guide.
Setup
Step 1. Enable Push Notifications Capability
Add the aps-environment entitlement to your Entitlements.plist file at Platforms/iOS/Entitlements.plist:
NoteChange development to production when publishing to the App Store.
Step 2. Enable Background Remote Notifications
Add the remote-notification background mode to your Info.plist at Platforms/iOS/Info.plist:
Step 3. Configure Code Signing in the .csproj
Add the signing configuration to your .csproj file to use the provisioning profile you created:
Step 4. Enable Automatic Push Configuration
In your AppDelegate.cs, call EnableAutomaticPushConfig() before the SDK is set up. This enables method swizzling so the Userpilot SDK automatically handles registering for remote notifications, receiving the device push token, and handling notification responses.
Android Setup
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
Step 1. Firebase Project Configuration
Follow the steps in the official Google documentation on How to add Firebase to your project.
Step 2. Register google-services.json in the .csproj
Add the GoogleServicesJson build action in your .csproj so .NET MAUI processes it and generates the required Android string resources (google_app_id, gcm_defaultSenderId, etc.):
Step 3. Add the Userpilot Firebase Messaging Service and Push Notification Permissions
Add the required permissions and the Userpilot Firebase Messaging Service to your AndroidManifest.xml at Platforms/Android/AndroidManifest.xml:
Step 4. Configure Notification Appearance
Create a resource file at Platforms/Android/Resources/values/userpilot.xml to customize the notification appearance:
Step 5. Handle Push Notification Intents in MainActivity
Configure your MainActivity.cs to forward push notification intents to the Userpilot SDK. Use LaunchMode.SingleTop to ensure deep links are routed to the existing activity instance.
Using ProGuard / R8 (Android)
If you are using R8 or ProGuard for code shrinking, add the following rules to your ProGuard configuration file (for example, Platforms/Android/proguard.cfg):
Then reference it in your .csproj: