user2384694 user2384694 - 10 days ago 6
iOS Question

Will silent notitifcation be displayed like normal notifications even if didReceiveRemoteNotifications is not called by iOS


  • Right now, my iOS app receives normal (non-silent) push notifications.

  • iOS device displays notifications as expected.

  • Now, I want to convert normal notifications to silent by adding
    "content-available=1"
    along with all other user visible keys.

  • To be able to perform bg tasks on notification trigger



My understanding is iOS may not always call
didReceiveRemoteNotifications
for silent notifications.

My question is would silent notifications will get displayed by iOS (if it contains user visible keys) even if iOS decides not to call
didReceiveRemoteNotifications


My expectation is silent notifications should work as is like normal notifications with an advantage of didReceiveRemoteNotifications getting called as and when possible (Best Effort)

I don't want to lose normal notification behavior by switching to silent notifications.

Answer

As per this link

For a silent notification, take care to ensure there is no alert, sound, or badge payload in the aps dictionary. If you don’t follow this guidance, the incorrectly-configured notification might be throttled and not delivered to the app in the background, and instead of being silent is displayed to the user

So if the keys alert, sound and badge are added then that notification will be displayed like a normal push notification.