Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Ios notifications not playing sound #352

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

SgtMadmonkey
Copy link

Notifications sounds are not being played on iOS while the app is in the foreground.

This issue was addressed in #295 , with the solution being a workaround by manually playing a sound.

Upon further investigation, I have determined the issue to be a missing flag on the WillPresentNotification completion handler.
This plays the sound defined within the notification payload's ApnsConfig object (see https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#apnsconfig).

For example, setting the following in your notification will play the user-defined default alert sound (iOS 17.2+):

"message": {
  ...
  "apns": {
    "payload": {
      "aps": {
        "sound" : "default"
      }
    }
  }
}

Additionally, I have included changes to support the UNNotificationPresentationOptions of Banner and List, introduced in iOS 14 (deprecating UNNotificationPresentationOptions.Alert).

Apologies if I did anything incorrect, this is my first public pull request and I was failing to install the legacy net 6.0 workloads to test, however I have custom implemented the WillPresentNotification delegate in my personal projects and is working as intended.

@AdamEssenmacher
Copy link
Collaborator

Thanks for the PR! I'll take a look.

Copy link
Collaborator

@AdamEssenmacher AdamEssenmacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SgtMadmonkey
Copy link
Author

Apologies, seems I did miss something. Accidentally removed the isSilentInForeground check - have amended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants