I’ve been able to get the basic iOS Local Notifications working, but for some reason the default alert sound will not play when the notification is received. I’m not customizing the sound so I should hear the default sound, but currently hear nothing. I double checked that my App’s settings have Notifications enabled and Sound enabled.
Am I missing a step in the process or am I not registering for sound notifications properly?
void Start () {
// Unity Local Notifications are only support on iOS
if (Application.platform == RuntimePlatform.IPhonePlayer) {
NotificationServices.RegisterForLocalNotificationTypes (LocalNotificationType.Alert | LocalNotificationType.Badge | LocalNotificationType.Sound);
// Test notification
LocalNotification notification = new LocalNotification ();
notification.alertBody = "Hello World";
notification.alertAction = "Alert Action";
notification.hasAction = true;
notification.applicationIconBadgeNumber = -1;
notification.fireDate = DateTime.Now.AddSeconds (10);
Dictionary<string,string> customData = new Dictionary<string, string> ();
customData.Add ("gem_bonus", "2");
customData.Add ("coin_bonus", "3");
notification.userInfo = customData;
NotificationServices.ScheduleLocalNotification (notification);
StartCoroutine (ReceiveLocalNotifications ());
}
}