-
Notifications
You must be signed in to change notification settings - Fork 21
How to handle a message when user opens the app by tapping on a notification alert?
Davor Komušanac edited this page Dec 5, 2022
·
8 revisions
In order to handle user tap on notification alert:
-
Implement
MMMessageHandlingDelegate
protocol and it's methoddidPerform(action:forMessage:completion:)
, i.e.:class MyMessageHandlingDelegate : MMMessageHandlingDelegate { func didPerform(action: MMNotificationAction, forMessage message: MM_MTMessage?, notificationUserInfo: [String: Any]?, completion: @escaping () -> Void) { if action.isTapOnNotificationAlert { // here you check if the action is indeed a tap on alert print("Message with text: \(message.text) was tapped") } // don't forget to call `completion`, it's very important to tell the system that action handling is finished completion() } }
-
Pass the delegate object to MobileMessaging SDK:
MobileMessaging.messageHandlindDelegate = MyMessageHandlingDelegate()
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
- Geofencing service
- Privacy settings
- In-app chat
- WebRTC Calls and UI