Skip to content

How to display modal mirror push notification manually

Alexander Boldyrev edited this page Oct 31, 2024 · 1 revision

Supported on iOS since version 9.1.0

  1. Disable automatic modal Mirror push notification displaying:

    1. Implement MMMessageHandlingDelegate protocol and return false from its method shouldShowModalInAppNotification(for message: MM_MTMessage):
    class MyMessageHandlingDelegate : MMMessageHandlingDelegate {
        func shouldShowModalInAppNotification(for message: MM_MTMessage) -> Bool {
            return false
        }
    }
    1. Pass the delegate object to MobileMessaging SDK:
    let messageHandler = MyMessageHandlingDelegate()
    MobileMessaging.messageHandlindDelegate = messageHandler
  2. At the moment MM_MTMessage is received by your app, retrieve it either of the following ways:

    • by implementing MMMessageHandlingDelegate protocol method didReceiveNewMessage(message: MM_MTMessage)
    class MyMessageHandlingDelegate : MMMessageHandlingDelegate {
        func didReceiveNewMessage(message: MM_MTMessage) {
            // save `message` into your variable
        }
    }
  3. Display modal Mirror push notification for message you retrieved on the previous step:

    MobileMessaging.showModalInAppNotification(forMessage: message)
Clone this wiki locally