Search code examples
iosswiftfirebasefirebase-in-app-messaging

How to send a simple data message from one user to another and bring up a page loading the data?


I was wondering how mobile news apps send messages where if you click on the push notification, the app takes you to the specific article. I am trying to perform a similar task but have the user generate a message and send it to another user. When the user on the other end receives the message, they should be taken to another view that displays the message data.

Would I use the Firebase In-App Messaging or would I need an external server with the Firebase Admin SDK implemented?


Solution

  • You need to make use of userNotificationCenter(_:didReceive:withCompletionHandler:), firing the appropriate logic based on the contents of your notifications, or the action selected by the user.

    See this blog post for an overview of how you can open a specific view controller from the background. As an example, this project on GitHub uses Firebase and seems to do what you're trying to do.