Microsoft Dynamics

JavaScript Bridge Functions

Prompt for Push Notification Permission

Request Push Notification permission. This will show a dialog for users to confirm permission. For Android, the dialog is only shown on Android 13 and above. In Android 12 and below, permission will always be granted without user intervention.

For this function, provide a callback function or otherwise a promise is returned.

↔️Median JavaScript Bridge

median.msdynamics.promptNotificationPermission();
// Return value:
{
  "granted": true | false
}

Check Push Notification Permission Status

For this function, provide a callback function or otherwise a promise is returned.

↔️Median JavaScript Bridge

median.msdynamics.areNotificationsEnabled({'callback': function});
// Return value:
{
  "granted": true | false
}

Register Device

Register a new user or update an existing user.

↔️Median JavaScript Bridge

median.msdynamics.registerDevice({
  userId: STRING // Alphanumeric UUID
});
// Return value:
{
  "success": true | false
}

Return Registration Info

Return device info with APNS and FCM tokens

↔️Median JavaScript Bridge

median.msdynamics.registrationInfo();
// Return value:
{
    apnsToken: '<xxxxxxxx xxxxxxxx xxxxxxxx ... >', // only on iOS
    fcmToken: '<xxxxxxxx xxxxxxxx xxxxxxxx ... >', // only on Android
    platform: 'ios',
    appId: 'io.median.example',
    appVersion:  '1.0.0',
    appBuild: '1.0.0', // will be appVersionCode (number) on Android
    distribution: 'release',
    hardware: 'armv8',
    installationId: 'xxxx-xxxx-xxxx-xxxx',
    language: 'en',
    model: 'iPhone',
    os: 'iOS',
    osVersion: '10.3',
    timeZone: 'America/New_York',
    isFirstLaunch: false // first time the app is launched
}