localnotificationsplugin icon indicating copy to clipboard operation
localnotificationsplugin copied to clipboard

No sound when notification is received in iOS

Open Nikdm46 opened this issue 7 years ago • 16 comments

No sound when notification is received in iOS(((

Nikdm46 avatar Dec 05 '17 09:12 Nikdm46

@Nikdm46 you can set that in your appdelegate.

ravinderjangra avatar Jan 12 '18 08:01 ravinderjangra

@ravinderjangra, But how?

Nikdm46 avatar Jan 17 '18 10:01 Nikdm46

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

Nikdm46 avatar Jan 17 '18 11:01 Nikdm46

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);
			}

ravinderjangra avatar Jan 17 '18 11:01 ravinderjangra

@jamesmontemagno, still no sound((

Nikdm46 avatar Jan 22 '18 09:01 Nikdm46

somebody help me!!!!!!

Nikdm46 avatar Jan 22 '18 09:01 Nikdm46

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

Nikdm46 avatar Jan 22 '18 09:01 Nikdm46

@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.

edsnider avatar Jan 22 '18 13:01 edsnider

@edsnider, public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> 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 avatar Jan 23 '18 09:01 Nikdm46

No sound, if app is not active too!

Nikdm46 avatar Jan 23 '18 09:01 Nikdm46

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!

oliver-ep avatar Apr 17 '18 15:04 oliver-ep

@edsnider I am also in the waiting list to to approve @ lorenzogiudici5 pull request. I think its pretty amazing that he solved sound and vibration problem.

ihassantariq avatar Jun 04 '18 16:06 ihassantariq

I am eagerly waiting as well.

uniphonic avatar Jun 13 '18 20:06 uniphonic

@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?

uniphonic avatar Jun 13 '18 22:06 uniphonic

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

Thanks in advance.

uphux avatar Jun 22 '18 12:06 uphux

@edsnider how about now?

karlingen avatar Jan 20 '19 18:01 karlingen