How to send Push without sound and indication on iOS

Hi, I need a feature in the iOS app that requires updating the user screen via FCM.

In other words, I have to update it with no sound and screen display, but this doesn't work.

When I remove the notification field, the notification will not be displayed to the user, but the sound will be played.

If I remove the sound field, I can make no sound, but the user will be notified.

If I remove both, I'm not getting this from the iOS app.

How can I solve this?? Which option should I send Push from the server??

I'm also using Notification Service Extension.

Answered by Engineer in 780221022

If I am understanding correctly, you want to update the app's UI based on a push, so I assume the app is in the foreground. When your app is in the foreground you can send a normal notification with alert text and optionally sound, and the willPresent() function in your app will be called first. https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter

You can suppress the notification altogether if your foreground app wants to handle it itself. You can read more about this here: https://developer.apple.com/documentation/usernotifications/handling_notifications_and_notification-related_actions#2942082

If you are trying to do this when your app is in the background, then you need to send a "background notification" which will silently wake up your app. You can read more about that here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app

Keep in mind though, background notifications are heavily throttled, and you can expect a maximum of 1-2 pushes to be received an hour under ideal conditions. And it is possible that you receive none if the system restricts them. In those cases, you will need to fetch any UI updates the next time your app is launched.

Accepted Answer

If I am understanding correctly, you want to update the app's UI based on a push, so I assume the app is in the foreground. When your app is in the foreground you can send a normal notification with alert text and optionally sound, and the willPresent() function in your app will be called first. https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter

You can suppress the notification altogether if your foreground app wants to handle it itself. You can read more about this here: https://developer.apple.com/documentation/usernotifications/handling_notifications_and_notification-related_actions#2942082

If you are trying to do this when your app is in the background, then you need to send a "background notification" which will silently wake up your app. You can read more about that here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app

Keep in mind though, background notifications are heavily throttled, and you can expect a maximum of 1-2 pushes to be received an hour under ideal conditions. And it is possible that you receive none if the system restricts them. In those cases, you will need to fetch any UI updates the next time your app is launched.

How to send Push without sound and indication on iOS
 
 
Q