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 Demo

Display 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 caseExample
Permission lifecycle controlRequest push permission at onboarding and re-check the status from the settings page.
Cross-install user identitySet a stable, unique ID after login and update aliases when account identifiers change.
Behavioral analyticsTrack named events with optional key-value payloads for campaign segmentation.
In-app message centerOpen the MoEngage notification inbox directly from app UI.
Deep-linked notificationsRoute users into specific app destinations when they tap a MoEngage notification.

What you'll do

  1. Configure credentials: Complete MoEngage FCM (Android) and APNS (iOS) setup per the Plugin setup section.
  2. Configure deep linking: Set up Median deep linking so notification links open in-app.
  3. Implement permission APIs: Use promptNotification and notificationEnabled from JavaScript bridge functions.
  4. Implement user identity and events: Add setUniqueId, setAlias, resetUser, trackEvent, and launchInbox calls.
  5. 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:

ParameterTypeRequiredDescription
callbackfunctionNoCalled 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:

ParameterTypeRequiredDescription
callbackfunctionNoCalled 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:

ParameterTypeRequiredDescription
uniqueidstringYesYour 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:

ParameterTypeRequiredDescription
aliasstringYesNew 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:

ParameterTypeRequiredDescription
eventNamestringYesThe event name as defined in your MoEngage schema.
payloadobjectNoKey-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:

  • median.moengage.promptNotification shows the permission prompt on Android 13+ and grants silently on Android 12 and below.
  • median.moengage.notificationEnabled returns expected status after permission is granted or denied.
  • median.moengage.setUniqueId, setAlias, and resetUser execute without JavaScript errors.
  • median.moengage.trackEvent logs events with and without payloads.
  • median.moengage.launchInbox opens the notification/subscription center.
  • Push notifications are delivered on Android with FCM authentication configured.
  • Push notifications are delivered on iOS with APNS authentication configured.
  • Notification links open directly inside the app with Median deep linking configured.
  • Notification links fall back gracefully when deep linking is not configured.
  • 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

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.

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.

Verify FCM Authentication is configured correctly in your MoEngage dashboard. Confirm the Google Services configuration in Median App Studio matches your Firebase project.

Verify APNS Authentication Key is correctly configured in your MoEngage dashboard. Confirm push entitlements and provisioning profiles are set for your iOS build.

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.