I'm developing iOS application in Unity. I need to show Local Push Notifications.
I use the next code:
public class TestNotification : MonoBehaviour {
void Start(){
UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound);
}
public void ShowNotification(){
#if UNITY_IOS
var iOSNotification = new UnityEngine.iOS.LocalNotification();
iOSNotification.alertBody = "Hello!";
UnityEngine.iOS.NotificationServices.PresentLocalNotificationNow(iOSNotification);
#else
Debug.LogError("Platform is not supported.");
#endif
}
}
When I call ShowNotification, notification appears in Notification Panel, but without any sound and popup. How to make my notifications show normally? I accepted all permissions(alert, sound, badge) on launch.
Testing Device: iPhone 4s, iOS 9.3.5
Build: Unity 5.4.4f1, XCode 8.2.1