MoEngage
Enable push notifications and user engagement events in your Median app using MoEngage's native iOS and Android SDKs.
Median integrates MoEngage's native SDKs on iOS and Android, including APNS Auth Keys (iOS) and FCM Authentication (Android), and exposes push permission management, user identity, event tracking, and the MoEngage notification center through the Median JavaScript Bridge.
Why use MoEngage
- Push permission management: Prompt for and check notification permissions from JavaScript on Android and iOS.
- Cross-platform user identity: Set stable unique IDs and aliases, and reset user data consistently across installs and platforms.
- Behavioral event tracking: Log named events with or without key-value payloads for MoEngage segmentation and campaigns.
- In-app notification center: Launch the MoEngage inbox and subscription center from any JavaScript context in your app.
Developer DemoDisplay our demo page in your app to test during development https://median.dev/moengage/
Prerequisites
- A Median.co app with JavaScript Bridge enabled
- MoEngage FCM authentication configured in your MoEngage dashboard (Android)
- MoEngage APNS authentication key configured in your MoEngage dashboard (iOS)
- Median deep linking configured for your app (required for notification links to open in-app destinations)
When to use this plugin
MoEngage is essential for apps that need to:
| Use case | Example |
|---|---|
| Permission lifecycle control | Request push permission at onboarding and re-check the status from the settings page. |
| Cross-install user identity | Set a stable, unique ID after login and update aliases when account identifiers change. |
| Behavioral analytics | Track named events with optional key-value payloads for campaign segmentation. |
| In-app message center | Open the MoEngage notification inbox directly from app UI. |
| Deep-linked notifications | Route users into specific app destinations when they tap a MoEngage notification. |
What you'll do
- Configure credentials: Complete MoEngage FCM (Android) and APNS (iOS) setup per the Plugin setup section.
- Configure deep linking: Set up Median deep linking so notification links open in-app.
- Implement permission APIs: Use
promptNotificationandnotificationEnabledfrom JavaScript bridge functions. - Implement user identity and events: Add
setUniqueId,setAlias,resetUser,trackEvent, andlaunchInboxcalls. - Validate: Run through the Testing checklist and check Troubleshooting for known issues.
Key terms
- FCM Authentication: Firebase Cloud Messaging, the push authentication mechanism for Android delivery. Configured in your MoEngage dashboard.
- APNS Auth Key: Apple Push Notification service authentication key for iOS delivery. Configured in your MoEngage dashboard.
- Deep Linking: A Median.co feature that routes notification URLs directly into in-app destinations rather than opening a browser.
Important considerations
- Android push permission dialogs appear on Android 13 and above; on Android 12 and below, permission is always granted without user interaction.
- Deep linking must be configured separately in Median App Studio for in-app notification routing to work.
Plugin setup
Enable the plugin
Median uses MoEngage native iOS and Android SDK integrations. Refer to MoEngage's documentation for FCM Authentication and APNS Authentication Key setup steps in the MoEngage dashboard.
JavaScript bridge functions
Prompt for Push Notification Permission
Prompts the user for push notification permission. On Android 13 and above, a system dialog is shown. On Android 12 and below, permission is always granted without user intervention.
Provide a callback function, or a promise is returned.
↔️Median JavaScript Bridge
// Using a callback median.moengage.promptNotification({ callback: function () {} }); // Using a promise median.moengage.promptNotification().then(function (result) { console.log('Notification permission result:', result); });
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
callback | function | No | Called on completion. Omit to use the returned promise. |
Check Push Notification Permission Status
Checks current push notification permission status.
Provide a callback function, or a promise is returned.
↔️Median JavaScript Bridge
// Using a callback median.moengage.notificationEnabled({ callback: function (result) { console.log('Notifications enabled:', result); }}); // Using a promise median.moengage.notificationEnabled().then(function (result) { console.log('Notifications enabled:', result); });
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
callback | function | No | Called with the permission status. Omit to use the returned promise. |
Set UniqueID
Sets a persistent user identifier across installs and platforms. Call after login to associate subsequent events and push tokens with the user.
↔️Median JavaScript Bridge
median.moengage.setUniqueId('uniqueid');
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
uniqueid | string | Yes | Your system's stable identifier for this user. |
Set Alias
Updates the existing user unique ID with a new alias. Use when a user's identifier changes, for example after account merging.
↔️Median JavaScript Bridge
median.moengage.setAlias('alias');
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
alias | string | Yes | New identifier to associate with the current user. |
Reset User
Resets unique ID and all data for the current user. Call on logout to disassociate the device from a user account.
↔️Median JavaScript Bridge
median.moengage.resetUser();
Log Event With or Without Data
Logs a named event with an optional key-value payload. Use for behavioral analytics and segmentation in MoEngage.
↔️Median JavaScript Bridge
// Event with payload median.moengage.trackEvent(eventName, { key_1: 'value_1', key_2: 'value_2' }); // Event without payload median.moengage.trackEvent('eventName');
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
eventName | string | Yes | The event name as defined in your MoEngage schema. |
payload | object | No | Key-value pairs to attach to the event. Omit for events without data. |
Notification Center
Launches the MoEngage notification and subscription center.
↔️Median JavaScript Bridge
median.moengage.launchInbox();
Testing checklist
Use this checklist to ensure MoEngage is working correctly in your app:
Basic Functionality
-
median.moengage.promptNotificationshows the permission prompt on Android 13+ and grants silently on Android 12 and below. -
median.moengage.notificationEnabledreturns expected status after permission is granted or denied. -
median.moengage.setUniqueId,setAlias, andresetUserexecute without JavaScript errors. -
median.moengage.trackEventlogs events with and without payloads. -
median.moengage.launchInboxopens the notification/subscription center.
Platform Testing
- Push notifications are delivered on Android with FCM authentication configured.
- Push notifications are delivered on iOS with APNS authentication configured.
Deep Linking
- Notification links open directly inside the app with Median deep linking configured.
- Notification links fall back gracefully when deep linking is not configured.
User Experience
- Users receive the push permission dialog at an appropriate point in the onboarding flow.
- Inbox opens correctly from UI entry points in the app.
Troubleshooting
Notification links do not open inside the app
Set up Median deep linking in App Studio so notification URLs resolve to in-app destinations. Without deep linking configured, tapping notification links may open an external browser instead.
MoEngage bridge methods are undefined at runtime
Confirm the MoEngage native plugin is enabled in Median App Studio and that the JavaScript Bridge is active for your app. Call bridge methods after the page is fully loaded.
Push notifications not delivered on Android
Verify FCM Authentication is configured correctly in your MoEngage dashboard. Confirm the Google Services configuration in Median App Studio matches your Firebase project.
Push notifications not delivered on iOS
Verify APNS Authentication Key is correctly configured in your MoEngage dashboard. Confirm push entitlements and provisioning profiles are set for your iOS build.
promptNotification has no effect on Android 12 and below
This is expected behavior. On Android 12 and below, push permission is always granted without user intervention. The prompt dialog is shown on Android 13 and above only.
Still having trouble?For issues related to MoEngage's own configuration, permissions, or platform-specific behavior outside Median's bridge, refer to MoEngage's integration documentation.
Updated 10 days ago