TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

No notification sound when IOS app is open #295

Closed mahebisht closed 4 months ago

mahebisht commented 4 months ago

I have a .NET MAUI 8 App. There is sound with notification when app is close and in background.

Notification is visible but no sound when app is running in IOS. I am testing with my mobile, IOS version is 16.6.1

Following is the code to send the message from web.

Dim notificationMessage As Message If isAndroid Then notificationMessage = New Message With { .Token = deviceToken } Else notificationMessage = New Message With { .Token = deviceToken, .Apns = New ApnsConfig With { .Aps = New Aps With { .Sound = "Default" } } } End If

mahebisht commented 4 months ago

I am able to fix the notification sound when app is open using the following code.

void NotificationReceived(object source, FCMNotificationReceivedEventArgs e) {

if IOS

    SystemSound sound = new SystemSound(1007);
    sound.PlaySystemSound();

endif

}
mahebisht commented 4 months ago

I am able to fix the notification sound when app is open in IOS