Esempio n. 1
0
    public void RegisterForRemoteNotifications(NotificationType notificationTypes)
    {
        ;
        #endif



                #if (UNITY_IPHONE && !UNITY_EDITOR && PUSH_ENABLED) || SA_DEBUG_MODE
        string sysInfo = SystemInfo.operatingSystem;
        sysInfo = sysInfo.Replace("iPhone OS ", "");
        string[] chunks       = sysInfo.Split('.');
        int      majorVersion = int.Parse(chunks[0]);
        if (majorVersion >= 8)
        {
            _ISN_RegisterForRemoteNotifications((int)notificationTypes);
        }

                #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
        NotificationServices.RegisterForRemoteNotificationTypes(notificationTypes);
                #else
        NotificationServices.RegisterForNotifications(notificationTypes);
                #endif

        DeviceTokenListener.Create();
                #endif
    }
Esempio n. 2
0
 /// <summary>
 /// Registruje aplikaciju za setovanje i primanje lokalnih notifikacija na IOS-u.
 /// </summary>
 public void RegisterForLocalNottifications()
 {
             #if UNITY_IOS && !UNITY_EDITOR
     //za tip notifikacije promeniti argument funkcije
     //ovo je default poziv
     NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
             #endif
 }
Esempio n. 3
0
 public iOSNotificationInterchange(string registerPath)
 {
     NotificationServices.RegisterForNotifications(
         NotificationType.Alert |
         NotificationType.Badge |
         NotificationType.Sound);
     this.registerPath = registerPath;
     this.register     = loadRegister();
 }
Esempio n. 4
0
    protected void RegisterForPushNotificationsIOS(bool isProvisional)
    {
#if !UNITY_EDITOR
        try {
            _swrveiOSRegisterForPushNotifications(Json.Serialize(config.NotificationCategories.Select(a => a.toDict()).ToList()), isProvisional);
            _saveConfigForPushDelivery();
        } catch (Exception exp) {
            SwrveLog.LogWarning("Couldn't invoke native code to register for push notifications, make sure you have the iOS plugin inside your project and you are running on a iOS device: " + exp.ToString());
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
        }
#endif
    }
Esempio n. 5
0
    protected void RegisterForPushNotificationsIOS()
    {
        try {
            _swrveiOSRegisterForPushNotifications(Json.Serialize(config.pushCategories.Select(a => a.toDict()).ToList()));
        } catch (Exception exp) {
            SwrveLog.LogWarning("Couldn't invoke native code to register for push notifications, make sure you have the iOS plugin inside your project and you are running on a iOS device: " + exp.ToString());

#if UNITY_5
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
#else
            NotificationServices.RegisterForRemoteNotificationTypes(RemoteNotificationType.Alert | RemoteNotificationType.Badge | RemoteNotificationType.Sound);
#endif
        }
    }
        /// <summary>
        /// Registers device for receiving Push Notifications
        /// </summary>
        /// <param name="mode">Application mode</param>
        internal void EnablePushNotificationAsync(TestMode mode)
        {
            _mode = mode;
#if UNITY_ANDROID && !UNITY_EDITOR
            _notificationsService.GetToken(result =>
            {
                _token = result;
            });
#endif
#if UNITY_IOS && !UNITY_EDITOR
            NotificationServices.RegisterForNotifications(
                NotificationType.Alert
                | NotificationType.Badge
                | NotificationType.Sound);
#endif
        }
Esempio n. 7
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
            }
        }
Esempio n. 8
0
 protected override void Start()
 {
     base.Start();
     NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
 }
Esempio n. 9
0
        /// <summary>
        /// Triggers native popup which asks user for permission to create notifications
        /// </summary>
        public static void RegisterForNotifications()
        {
#if UNITY_IOS
            NotificationServices.RegisterForNotifications((NotificationType)7);
#endif
        }
Esempio n. 10
0
 public IosNotifyBridge()
 {
     NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
     scheduleNotifications = new List <LocalNotification>();
 }