Fcm Notification in iOS Doesn't Play Sound When Received

how to play custom notification sound in ios push notification using FCM

thanks for your answers and comments

It is working fine now after adding notification file in build phases (Xcode).

For Ref: Playing a custom sound on receiving a remote push notification on iOS 12 from FCM

FCM custom sound not working on iOS when in background mode

After several additional rounds communication with Firebase, here is the current status update and their response:

I would like to let you know that this issue was just recently
identified as a bug with our Legacy API that’s not properly handling
the custom sound for iOS. Our FCM gurus have identified the fix for
this issue, and the fix is about to be released on our production, but
we can’t share any exact details or timeline for the release. The fix
should let you send notifications properly based on your custom sounds
configuration and there should be no code changes needed on your end.
Also, it should still properly handle the notification sounds if the
app is closed or in background state for your iOS application.

We are furthermore told that for the moment, migration from FCM HTTP to HTTP v1 is the only work around. Will post here again once we hear confirmation on the fix to the Legacy API (which most people reading this as using). Stay tuned...

Enable Default Sound on FCM Push Notification for iOS

insane, but for me, some reason in appdelegate the window variable was deleted and that resulted into this issue..

adding it back, sound works correctly now...

Push notification ios from Firebase is received but no sound or in notification center

If your app is open, the operating system will not present the banner or play a sound on its own. Instead, you get notified about the notification in your AppDelegate.

If you target iOS 10 or above, you can use UNUserNotificationCenter and it lets you present the notification even if your app is open. Below is an example:

In your NUserNotificationCenterDelegate object, pass .alert, .badge or .sound to the completion block of willPresent notification method:

func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
{
completionHandler([.alert, .badge, .sound])
}

Although be very cautious about this approach. Users can easily forbid your app from presenting any notifications. If so, the above method will result in nothing being shown to the user.

It may be a better approach to present all notifications yourself if your app is open.



Related Topics



Leave a reply



Submit