-
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?
Andrey Kadochnikov edited this page Jan 30, 2018
·
8 revisions
In order to handle user tap on notification alert:
-
Implement
MessageHandlingDelegate
protocol and it's methoddidPerform(action:forMessage:completion:)
, i.e.:class MyMessageHandlingDelegate : MessageHandlingDelegate { func didPerform(action: NotificationAction, forMessage message: MTMessage, 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.sharedInstance?.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