0

I am working in a project where I need to show notifications fired by Firebase. Everything works fine with the send and receive flow. But I need to customise the notification before showing it, i.e., when the app is in background. Because the message I receive from our server it's already Base64 encoded. And therefore the notification displays a long string that my petrify the users. Is there any delegate or something which I can use to modify the received data before presenting it when the app is in background?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

2 Answers2

1

Currently there is no way in iOS to do that. Please refer to this answer for more details How to change how a remote notification is presented before presentation?

Moaz Khan
  • 1,272
  • 1
  • 13
  • 28
0

You can use these following in your project to handle any data.

Works only for iOS 10.2 or greater

UNNotificationServiceExtension

UNNotificationContentExtension

Go through this link - https://medium.com/@prianka.kariat/ios-10-notifications-with-attachments-and-much-more-169a7405ddaf

As i have limited time please let me know if you need more explanation on this.

Debugging is also a tricky part in this First you go through this then try to debug by GO to DEBUG -> Attach to process by pid and paste your extension name you added.

  • Our concern is to handle the **Data** and **Notification** before the app enters foreground. Because the data (as in Chat) we receive is base64 encoded. We need to decode it before showing. –  Apr 19 '18 at 05:04