How to change how a remote notification is presented before presentation?

前端 未结 2 944
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 04:08

How should I change how a remote notification is presented in iOS before the system presents it? In fact, silence it. There are times where my app has canceled a Firebase to

相关标签:
2条回答
  • 2021-01-17 04:17

    That's a great question and currently there is no solution for this problem o iOS.

    You can read about this on the Apple guide for local and push notifications.

    https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/

    PS: If by silent you meant change the sound that the notification makes, you can do it. https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ModifyingNotifications.html#//apple_ref/doc/uid/TP40008194-CH16-SW1

    0 讨论(0)
  • 2021-01-17 04:31

    UPDATE: Please refer to this answer to track the latest changes

    There is no interception possible for remote notifications.

    But the thing you want to do is possible like:

    • You modify the notification payload to be a silent push notification
    • You opt-in the Remote Notifications in background modes of your app's capabilities
    • Then use local notifications. When you receive a remote notification from your server, you will be able to decide to show or not any local notifications.

    Footnote: In this approach, if the user has killed the app by swiping it up in the fast app switching mode, you won't be able to get any callbacks for your app in background when you receive a remote notification.

    0 讨论(0)
提交回复
热议问题