예제 #1
0
        private void RegisterForNotifications()
        {
            m_initRemoteNotifications = Settings.Instance.PushNotificationsEnabledIOS && m_pushEnabled;

            //Workaround for a bug in some versions of Unity: http://forum.unity3d.com/threads/local-notification-not-working-in-ios-8-unity4-5-4-xcode6-0-1.271487/
            if (!_UT_RegisterForIOS8(m_initRemoteNotifications))
            {
#if UNITY_5_PLUS
                NotificationServices.RegisterForNotifications(NotificationType.Badge | NotificationType.Alert | NotificationType.Sound, m_initRemoteNotifications);
#else
#if UNITY_4_6_PLUS
                NotificationServices.RegisterForLocalNotificationTypes(LocalNotificationType.Badge | LocalNotificationType.Alert | LocalNotificationType.Sound);
#endif
                if (m_initRemoteNotifications)
                {
                    NotificationServices.RegisterForRemoteNotificationTypes(RemoteNotificationType.Badge | RemoteNotificationType.Alert | RemoteNotificationType.Sound);
                }
#endif
            }
        }