-
Notifications
You must be signed in to change notification settings - Fork 22
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
-
Disable automatic modal Mirror push notification displaying:
- Implement
MMMessageHandlingDelegateprotocol and returnfalsefrom its methodshouldShowModalInAppNotification(for message: MM_MTMessage):
class MyMessageHandlingDelegate : MMMessageHandlingDelegate { func shouldShowModalInAppNotification(for message: MM_MTMessage) -> Bool { return false } }
- Pass the delegate object to MobileMessaging SDK:
let messageHandler = MyMessageHandlingDelegate() MobileMessaging.messageHandlindDelegate = messageHandler
- Implement
-
At the moment
MM_MTMessageis received by your app, retrieve it either of the following ways:- by implementing
MMMessageHandlingDelegateprotocol methoddidReceiveNewMessage(message: MM_MTMessage)
class MyMessageHandlingDelegate : MMMessageHandlingDelegate { func didReceiveNewMessage(message: MM_MTMessage) { // save `message` into your variable } }
- by subscribing to
MMNotificationMessageReceivednotification (learn more about iOS NotificationCenter) and retrieving the message from the notification user data (example)
- by implementing
-
Display modal Mirror push notification for message you retrieved on the previous step:
MobileMessaging.showModalInAppNotification(forMessage: message)
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.