edsnider / localnotificationsplugin

Local Notifications Plugin for Xamarin and Windows
MIT License
198 stars 82 forks source link

No sound when notification is received in iOS #31

Open Nikdm46 opened 6 years ago

Nikdm46 commented 6 years ago

No sound when notification is received in iOS(((

ravinderjangra commented 6 years ago

@Nikdm46 you can set that in your appdelegate.

Nikdm46 commented 6 years ago

@ravinderjangra, But how?

Nikdm46 commented 6 years ago

UNUserNotificationCenter.Current.RequestAuthorization( UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (approved, error) => { }); But no sound!!!!!

ravinderjangra commented 6 years ago
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
                       UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                       new NSSet());
                UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }
Nikdm46 commented 6 years ago

@jamesmontemagno, still no sound((

Nikdm46 commented 6 years ago

somebody help me!!!!!!

Nikdm46 commented 6 years ago

it looks as though there was no sound in the plug-in at the same time. And alerts are created without a sound

edsnider commented 6 years ago

@Nikdm46 are you running on iOS 10+? If so, did you also add sound to the alert options in your UNUserNotificationCenterDelegate? If you app is active, this delegate is how you specify what the notifications should do - take a look at the README and the sample.

Nikdm46 commented 6 years ago

@edsnider, public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action completionHandler) { // Tell system to display the notification anyway or use // None to say we have handled the display locally. completionHandler(UNNotificationPresentationOptions.Alert | UNNotificationPresentationOptions.Sound); } It did not help!(

Nikdm46 commented 6 years ago

No sound, if app is not active too!

oliver-ep commented 6 years ago

Hi @edsnider, @Nikdm46 I've replicated the issue on my iOS 10+ device, I think the iOS implementation is missing the Sound property for notifications - see line 100 here:

https://github.com/edsnider/LocalNotificationsPlugin/blob/master/src/Plugin.LocalNotifications.iOS/LocalNotificationsImplementation.cs

as much as I can tell, even if the developer configured completionHandler with UNNotificationPresentationOptions.Sound they won't hear anything - because the sound isn't set!

Luckily for us lorenzogiudici5 has made a Pull Request that seems to address this issue.

https://github.com/edsnider/Xamarin.Plugins/pull/33/files

so if @edsnider can test and approve that PR maybe things would move forward. From personal experience notification without sound isn't that useful, so I can't use this package until this issue is resolved!

uniphonic commented 6 years ago

I am eagerly waiting as well.

uniphonic commented 6 years ago

@oliver-eastpoint , the pull request you pointed out looks like it's for the old repo, so I'm not sure how easy it would be to pull it into the new repo?

I noticed there is another pull request for the current repo, which also looks like it addresses the sound issue, though I don't know if it addresses vibration as well. It's pull request #17

I'd be happy with either, though the vibration working too seems important.

@edsnider , does either of those look OK to you?

Also, with the latest version, I've tried Android, and am not hearing any sound there either. Does this issue affect Android as well?

uphux commented 6 years ago

@edsnider, can you please add sound and vibration feature to your plugin?

Thanks in advance.

karlingen commented 5 years ago

@edsnider how about now?