Esempio n. 1
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    protected override void Awake()
    {
        base.Awake();

                #if UNITY_IOS && UNITY_5
        if (UnityEngine.iOS.NotificationServices.localNotificationCount > 0)
        {
            UnityEngine.iOS.LocalNotification n = UnityEngine.iOS.NotificationServices.localNotifications[0];

            ISN_LocalNotification notif = new ISN_LocalNotification(DateTime.Now, n.alertBody, true);

            int id = 0;
            if (n.userInfo.Contains("AlarmKey"))
            {
                id = System.Convert.ToInt32(n.userInfo["AlarmKey"]);
            }

            if (n.userInfo.Contains("data"))
            {
                notif.SetData(System.Convert.ToString(n.userInfo["data"]));
            }
            notif.SetId(id);
            _LaunchNotification = notif;
        }
                #endif
    }
 public void ScheduleNotification(ISN_LocalNotification notification)
 {
             #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
     int time = System.Convert.ToInt32((notification.Date - DateTime.Now).TotalSeconds);
     _ISN_ScheduleNotification(time, notification.Message, notification.UseSound, notification.Id.ToString(), notification.Badges, notification.Data);
             #endif
 }
Esempio n. 3
0
    void OnApplicationPause(bool pauseStatus)
    {
        // ローカル通知用
        if (pauseStatus)
        {
            //TODO
                        #if UNITY_IPHONE
            foreach (CsvLocalNotificationData data in m_localNotificationDataList)
            {
                ISN_LocalNotification local_notification = new ISN_LocalNotification(
                    DateTime.Now.AddSeconds(data.second),
                    data.message,
                    false);

                id_list.Add(local_notification.Id);
                IOSNotificationController.Instance.ScheduleNotification(local_notification);
            }
                        #elif UNITY_ANDROID
            int iTemp = 0;

            /*
             * iTemp = EtceteraAndroid.scheduleNotification( Define.iLocalNotifyMessageTime1, "どうぶつみっけ!", Define.strLocalNotifyMessage1, Define.strLocalNotifyMessage1, Define.strLocalNotifyMessage1 );
             * localnotificate_list.Add( iTemp );
             * iTemp = EtceteraAndroid.scheduleNotification( Define.iLocalNotifyMessageTime2, "どうぶつみっけ!", Define.strLocalNotifyMessage2, Define.strLocalNotifyMessage2, Define.strLocalNotifyMessage2 );
             * localnotificate_list.Add( iTemp );
             */

            foreach (CsvLocalNotificationData data in m_localNotificationDataList)
            {
                //Debug.LogError( string.Format( "add local notification:{0}" , data.message ));

                m_plugin2.Call("sendNotification", (long)data.second, iTemp, data.title, data.message);
                iTemp += 1;
                //iTemp = EtceteraAndroid.scheduleNotification( data.second, data.title, data.message, data.message, data.message );
            }
            //iTemp = EtceteraAndroid.scheduleNotification( 20, "どうぶつみっけ!", Define.strLocalNotifyMessage2, Define.strLocalNotifyMessage2, Define.strLocalNotifyMessage2 );
                        #endif
        }
        else
        {
                        #if UNITY_IPHONE
            // こっちの削除はなくてもいいらしい
            foreach (int set_id in id_list)
            {
                IOSNotificationController.Instance.CancelLocalNotificationById(set_id);
            }
            //IOSNotificationController.Instance.CancelAllLocalNotifications ();
                        #elif UNITY_ANDROID
            int iTemp = 0;
            foreach (CsvLocalNotificationData data in m_localNotificationDataList)
            {
                m_plugin2.Call("clearNotification", iTemp);
                iTemp += 1;
            }
                        #endif
        }
    }
Esempio n. 4
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    void Awake()
    {
        DontDestroyOnLoad(gameObject);

                #if UNITY_IPHONE || UNITY_IOS
                #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 || UNITY_4_7
        if (NotificationServices.localNotificationCount > 0)
        {
            LocalNotification n = NotificationServices.localNotifications[0];

            ISN_LocalNotification notif = new ISN_LocalNotification(DateTime.Now, n.alertBody, true);

            int id = 0;
            if (n.userInfo.Contains("AlarmKey"))
            {
                id = System.Convert.ToInt32(n.userInfo["AlarmKey"]);
            }

            if (n.userInfo.Contains("data"))
            {
                notif.SetData(System.Convert.ToString(n.userInfo["data"]));
            }
            notif.SetId(id);

            _LaunchNotification = notif;
        }
                #else
                        #if UNITY_IOS
        if (UnityEngine.iOS.NotificationServices.localNotificationCount > 0)
        {
            UnityEngine.iOS.LocalNotification n = UnityEngine.iOS.NotificationServices.localNotifications[0];

            ISN_LocalNotification notif = new ISN_LocalNotification(DateTime.Now, n.alertBody, true);

            int id = 0;
            if (n.userInfo.Contains("AlarmKey"))
            {
                id = System.Convert.ToInt32(n.userInfo["AlarmKey"]);
            }

            if (n.userInfo.Contains("data"))
            {
                notif.SetData(System.Convert.ToString(n.userInfo["data"]));
            }
            notif.SetId(id);

            _LaunchNotification = notif;
        }
                        #endif
                #endif
                #endif
    }
Esempio n. 5
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    void Awake()
    {
        IOSNotificationController.instance.RequestNotificationPermissions();

        IOSNotificationController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived;

        if (IOSNotificationController.Instance.LaunchNotification != null)
        {
            ISN_LocalNotification notification = IOSNotificationController.Instance.LaunchNotification;

            IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data);
        }
    }
Esempio n. 6
0
    void OnApplicationPause(bool pauseStatus)
    {
        // ローカル通知用
                #if UNITY_ANDROID && !UNITY_EDITOR
        //m_plugin2.Call ("sendNotification", _lTime, m_iLocalNotificationIndex, _strTitle, _strTitle, _strMessage , permissive );
                #endif
        if (pauseStatus)
        {
            //TODO
                        #if UNITY_IPHONE
            foreach (CsvLocalNotificationData data in m_localNotificationDataList)
            {
                ISN_LocalNotification local_notification = new ISN_LocalNotification(
                    DateTime.Now.AddSeconds(data.second),
                    data.message,
                    false);

                id_list.Add(local_notification.Id);
                IOSNotificationController.Instance.ScheduleNotification(local_notification);
            }
                        #elif UNITY_ANDROID
            /*
             * int iTemp = 0;
             * foreach( CsvLocalNotificationData data in m_localNotificationDataList ){
             *      m_plugin2.Call ("sendNotification", (long)data.second , iTemp , data.title, data.message);
             *      iTemp += 1;
             * }
             */
                        #endif
        }
        else
        {
                        #if UNITY_IPHONE
            // こっちの削除はなくてもいいらしい
            foreach (int set_id in id_list)
            {
                IOSNotificationController.Instance.CancelLocalNotificationById(set_id);
            }
            //IOSNotificationController.Instance.CancelAllLocalNotifications ();
                        #elif UNITY_ANDROID
            /*
             * int iTemp = 0;
             * foreach( CsvLocalNotificationData data in m_localNotificationDataList ){
             *      m_plugin2.Call ("clearNotification", iTemp );
             *      iTemp += 1;
             * }
             */
                        #endif
        }
    }
Esempio n. 7
0
    public void ScheduleNotification(ISN_LocalNotification notification)
    {
                #if (UNITY_IOS && !UNITY_EDITOR) || SA_DEBUG_MODE
        int time = System.Convert.ToInt32((notification.Date - DateTime.Now).TotalSeconds);

        List <ISN_LocalNotification> scheduled = LoadPendingNotifications();
        scheduled.Add(notification);
        SaveNotifications(scheduled);



        _ISN_ScheduleNotification(time, notification.Message, notification.UseSound, notification.Id.ToString(), notification.Badges, notification.Data, notification.SoundName);
                #endif
    }
    public int ScheduleLocalNotification(string title, string message, int seconds)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.Android:
            return(AndroidNotificationManager.instance.ScheduleLocalNotification(title, message, seconds));

        case RuntimePlatform.IPhonePlayer:
            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(seconds), message, true);
            notification.Schedule();
            return(notification.Id);
        }

        return(0);
    }
Esempio n. 9
0
    private void OnLocalNotificationReceived_Event(string array)
    {
        string[] data;
        data = array.Split("|" [0]);

        string msg      = data[0];
        int    Id       = System.Convert.ToInt32(data[1]);
        string notifDta = data[2];
        int    badges   = System.Convert.ToInt32(data[3]);

        ISN_LocalNotification n = new ISN_LocalNotification(DateTime.Now, msg);

        n.SetData(notifDta);
        n.SetBadgesNumber(badges);
        n.SetId(Id);

        OnLocalNotificationReceived(n);
    }
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    void Awake()
    {
        ISN_LocalNotificationsController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived;



        //Checking for a local launch notification
        if (ISN_LocalNotificationsController.Instance.LaunchNotification != null)
        {
            ISN_LocalNotification notification = ISN_LocalNotificationsController.Instance.LaunchNotification;

            IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data);
        }


        //Checking for a remote launch notification
        if (ISN_RemoteNotificationsController.Instance.LaunchNotification != null)
        {
            ISN_RemoteNotification notification = ISN_RemoteNotificationsController.Instance.LaunchNotification;

            IOSMessage.Create("Launch Remote Notification", "Body: " + notification.Body);
        }
    }
Esempio n. 11
0
    public List <ISN_LocalNotification> LoadPendingNotifications(bool includeAll = false)
    {
                #if UNITY_IOS
        string data = string.Empty;
        if (PlayerPrefs.HasKey(PP_KEY))
        {
            data = PlayerPrefs.GetString(PP_KEY);
        }

        List <ISN_LocalNotification> tpls = new List <ISN_LocalNotification>();

        if (data != string.Empty)
        {
            string[] notifications = data.Split(SA.Common.Data.Converter.DATA_SPLITTER);

            foreach (string n in notifications)
            {
                String templateData = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(n));

                try {
                    ISN_LocalNotification notification = new ISN_LocalNotification(templateData);

                    if (!notification.IsFired || includeAll)
                    {
                        tpls.Add(notification);
                    }
                } catch (Exception e) {
                    ISN_Logger.Log("IOS Native. IOSNotificationController loading notification data failed: " + e.Message);
                }
            }
        }
        return(tpls);
                #else
        return(null);
                #endif
    }
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------


    void Awake()
    {
        ISN_LocalNotificationsController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived;



        NotificationCenter.OnWillPresentNotification += (NotificationRequest obj) => {
            Debug.Log("OnWillPresentNotification: " + obj.Content);
        };

        var launchNotification = NotificationCenter.LaunchNotification;

        if (launchNotification.Content != null)
        {
            IOSMessage.Create("Launch Notification", "Messgae: " + launchNotification.Content + "\nNotification ID: " + launchNotification.Id);
        }



        //Checking for a local launch notification
        if (ISN_LocalNotificationsController.Instance.LaunchNotification != null)
        {
            ISN_LocalNotification notification = ISN_LocalNotificationsController.Instance.LaunchNotification;

            IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data);
        }


        //Checking for a remote launch notification
        if (ISN_RemoteNotificationsController.Instance.LaunchNotification != null)
        {
            ISN_RemoteNotification notification = ISN_RemoteNotificationsController.Instance.LaunchNotification;

            IOSMessage.Create("Launch Remote Notification", "Body: " + notification.Body);
        }
    }
Esempio n. 13
0
 public void CancelLocalNotification(ISN_LocalNotification notification)
 {
     CancelLocalNotificationById(notification.Id);
 }
	//--------------------------------------
	//  PUBLIC METHODS
	//--------------------------------------
	
	void OnGUI() {
		
		UpdateToStartPos();
		
		UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);
		
		
		StartY+= YLableStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification Silent")) {
			IOSNotificationController.OnNotificationScheduleResult += OnNotificationScheduleResult;

			ISN_LocalNotification notification =  new ISN_LocalNotification(DateTime.Now.AddSeconds(5),"Your Notification Text No Sound", false);
			notification.SetData("some_test_data");
			notification.Schedule();

			lastNotificationId = notification.Id;
		}
		
		StartX += XButtonStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification")) {
			IOSNotificationController.OnNotificationScheduleResult += OnNotificationScheduleResult;

			ISN_LocalNotification notification =  new ISN_LocalNotification(DateTime.Now.AddSeconds(5),"Your Notification Text", true);
			notification.SetData("some_test_data");
			notification.SetSoundName("purchase_ok.wav");
			notification.SetBadgesNumber(1);
			notification.Schedule();

			lastNotificationId = notification.Id; 
		}
		
		
		StartX += XButtonStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel All Notifications")) {
			IOSNotificationController.instance.CancelAllLocalNotifications();
			IOSNativeUtility.SetApplicationBagesNumber(0);
		}
		
		StartX += XButtonStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cansel Last Notification")) {


			IOSNotificationController.instance.CancelLocalNotificationById(lastNotificationId);
		}
		
		
		StartX = XStartPos;
		StartY+= YButtonStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Reg Device For Push Notif. ")) {
			
			
			
			#if UNITY_IPHONE
			
			#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
			IOSNotificationController.Instance.RegisterForRemoteNotifications (RemoteNotificationType.Alert |  RemoteNotificationType.Badge |  RemoteNotificationType.Sound);

			IOSNotificationController.OnDeviceTokenReceived += OnDeviceTokenReceived;

			#else
			IOSNotificationController.Instance.RegisterForRemoteNotifications (NotificationType.Alert |  NotificationType.Badge |  NotificationType.Sound);
			IOSNotificationController.OnDeviceTokenReceived += OnDeviceTokenReceived;
			#endif
			
			
			
			#endif
			
			
		}
		
		StartX += XButtonStep;
		if(UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Game Kit Notification")) {
			IOSNotificationController.instance.ShowGmaeKitNotification("Title", "Message");
		}
		
		
	}
	void HandleOnLocalNotificationReceived (ISN_LocalNotification notification) {
		IOSMessage.Create("Notification Received", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data);
	}
Esempio n. 16
0
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    void OnGUI()
    {
        UpdateToStartPos();

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);


        StartY += YLableStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification Silent"))
        {
            IOSNotificationController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text No Sound", false);
            notification.SetData("some_test_data");
            notification.Schedule();

            lastNotificationId = notification.Id;
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification"))
        {
            IOSNotificationController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text", true);
            notification.SetData("some_test_data");
            notification.SetSoundName("purchase_ok.wav");
            notification.SetBadgesNumber(1);
            notification.Schedule();

            lastNotificationId = notification.Id;
        }


        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel All Notifications"))
        {
            IOSNotificationController.instance.CancelAllLocalNotifications();
            IOSNativeUtility.SetApplicationBagesNumber(0);
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cansel Last Notification"))
        {
            IOSNotificationController.instance.CancelLocalNotificationById(lastNotificationId);
        }


        StartX  = XStartPos;
        StartY += YButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Reg Device For Push Notif. "))
        {
                        #if UNITY_IPHONE
                        #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 || UNITY_4_7
            IOSNotificationController.Instance.RegisterForRemoteNotifications(RemoteNotificationType.Alert | RemoteNotificationType.Badge | RemoteNotificationType.Sound);

            IOSNotificationController.OnDeviceTokenReceived += OnDeviceTokenReceived;
                        #else
            IOSNotificationController.Instance.RegisterForRemoteNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
            IOSNotificationController.OnDeviceTokenReceived += OnDeviceTokenReceived;
                        #endif
                        #endif
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Game Kit Notification"))
        {
            IOSNotificationController.instance.ShowGmaeKitNotification("Title", "Message");
        }
    }
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    void OnGUI()
    {
        UpdateToStartPos();

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);


        StartY += YLableStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Request Permissions"))
        {
            ISN_LocalNotificationsController.Instance.RequestNotificationPermissions();
        }


        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Print Notification Settings"))
        {
            CheckNotificationSettings();
        }


        StartY += YButtonStep;
        StartX  = XStartPos;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification Silent"))
        {
            ISN_LocalNotificationsController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text No Sound", false);
            notification.SetData("some_test_data");
            notification.Schedule();

            lastNotificationId = notification.Id;
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification"))
        {
            ISN_LocalNotificationsController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text", true);
            notification.SetData("some_test_data");
            notification.SetSoundName("purchase_ok.wav");
            notification.SetBadgesNumber(1);
            notification.Schedule();

            lastNotificationId = notification.Id;
        }


        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel All Notifications"))
        {
            ISN_LocalNotificationsController.Instance.CancelAllLocalNotifications();
            IOSNativeUtility.SetApplicationBagesNumber(0);
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cansel Last Notification"))
        {
            ISN_LocalNotificationsController.Instance.CancelLocalNotificationById(lastNotificationId);
        }


        StartX  = XStartPos;
        StartY += YButtonStep;
        StartY += YLableStep;

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);


        StartY += YLableStep;
        StartX  = XStartPos;

        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Reg Device For Push Notif. "))
        {
            //ISN_RemotelNotifications.Instance.RegisterForRemoteNotifications (0);

            ISN_RemoteNotificationsController.Instance.RegisterForRemoteNotifications((ISN_RemoteNotificationsRegistrationResult res) => {
                Debug.Log("ISN_RemoteNotificationsRegistrationResult: " + res.IsSucceeded);
                if (!res.IsSucceeded)
                {
                    Debug.Log(res.Error.Code + " / " + res.Error.Message);
                }
                else
                {
                    Debug.Log(res.Token.DeviceId);
                }
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Game Kit Notification"))
        {
            ISN_LocalNotificationsController.Instance.ShowGmaeKitNotification("Title", "Message");
        }
    }
Esempio n. 18
0
 void HandleOnLocalNotificationReceived(ISN_LocalNotification notification)
 {
     IOSMessage.Create("Notification Received", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data);
 }
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    void OnGUI()
    {
        UpdateToStartPos();

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);


        StartY += YLableStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Request Permissions"))
        {
            ISN_LocalNotificationsController.Instance.RequestNotificationPermissions();
        }


        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Print Notification Settings"))
        {
            CheckNotificationSettings();
        }


        StartY += YButtonStep;
        StartX  = XStartPos;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification Silent"))
        {
            ISN_LocalNotificationsController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text No Sound", false);
            notification.SetData("some_test_data");
            notification.Schedule();

            lastNotificationId = notification.Id;
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule Notification"))
        {
            ISN_LocalNotificationsController.OnNotificationScheduleResult += OnNotificationScheduleResult;

            ISN_LocalNotification notification = new ISN_LocalNotification(DateTime.Now.AddSeconds(5), "Your Notification Text", true);
            notification.SetData("some_test_data");
            notification.SetSoundName("purchase_ok.wav");
            notification.SetBadgesNumber(1);
            notification.Schedule();

            lastNotificationId = notification.Id;
        }


        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel All Notifications"))
        {
            ISN_LocalNotificationsController.Instance.CancelAllLocalNotifications();
            IOSNativeUtility.SetApplicationBagesNumber(0);
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cansel Last Notification"))
        {
            ISN_LocalNotificationsController.Instance.CancelLocalNotificationById(lastNotificationId);
        }


        StartX  = XStartPos;
        StartY += YButtonStep;
        StartY += YLableStep;

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "Local and Push Notifications", style);


        StartY += YLableStep;
        StartX  = XStartPos;

        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Reg Device For Push Notif. "))
        {
            //ISN_RemotelNotifications.Instance.RegisterForRemoteNotifications (0);

            ISN_RemoteNotificationsController.Instance.RegisterForRemoteNotifications((ISN_RemoteNotificationsRegistrationResult res) => {
                Debug.Log("ISN_RemoteNotificationsRegistrationResult: " + res.IsSucceeded);
                if (!res.IsSucceeded)
                {
                    Debug.Log(res.Error.Code + " / " + res.Error.Message);
                }
                else
                {
                    Debug.Log(res.Token.DeviceId);
                }
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Game Kit Notification"))
        {
            ISN_LocalNotificationsController.Instance.ShowGmaeKitNotification("Title", "Message");
        }



        StartX  = XStartPos;
        StartY += YButtonStep;
        StartY += YLableStep;

        UnityEngine.GUI.Label(new UnityEngine.Rect(StartX, StartY, UnityEngine.Screen.width, 40), "User Notifications", style);


        StartY += YLableStep;
        StartX  = XStartPos;

        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Reg Device For User Notif. "))
        {
            SA.IOSNative.UserNotifications.NotificationCenter.RequestPermissions((result) => {
                ISN_Logger.Log("RequestPermissions callback" + result.ToString());
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule for 5 sec"))
        {
            var content = new SA.IOSNative.UserNotifications.NotificationContent();
            content.Title            = "Title_";
            content.Subtitle         = "Subtitle_";
            content.Body             = "Body_";
            content.Badge            = 1;
            content.Sound            = "beep.mp3";
            content.UserInfo ["404"] = "test User Info";


            var trigger = new SA.IOSNative.UserNotifications.TimeIntervalTrigger(5);
            var request = new SA.IOSNative.UserNotifications.NotificationRequest("some0id0", content, trigger);
            ISN_Logger.Log("request Schedule for 5 sec");
            SA.IOSNative.UserNotifications.NotificationCenter.AddNotificationRequest(request, (result) => {
                ISN_Logger.Log("request callback");
                ISN_Logger.Log(result.ToString());
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule by Calendar - Date Components"))
        {
            var content = new SA.IOSNative.UserNotifications.NotificationContent();
            content.Title            = "Calendar - Date Components";
            content.Subtitle         = "Subtitle_";
            content.Body             = "Body_";
            content.Badge            = 1;
            content.UserInfo ["404"] = "test User Info";

            var dateComponents = new SA.IOSNative.UserNotifications.DateComponents()
            {
                Second = 32,
                //          You can use any of this fields or their combination; In this example, trigger will fire every 32nd second

                //			public int? Year;
                //			public int? Month;
                //			public int? Day;
                //			public int? Hour;
                //			public int? Minute;
                //			public int? Second;
                //			public int? Weekday; (1 - Sunday, 7 - Saturday)
                //			public int? Quarter;
            };

            var trigger = new SA.IOSNative.UserNotifications.CalendarTrigger(dateComponents);
            trigger.SetRepeat(true);
            var request = new SA.IOSNative.UserNotifications.NotificationRequest("some0id1", content, trigger);

            SA.IOSNative.UserNotifications.NotificationCenter.AddNotificationRequest(request, (result) => {
                ISN_Logger.Log("request callback");
                ISN_Logger.Log(result.ToString());
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Schedule by Calendar - Date"))
        {
            var content = new SA.IOSNative.UserNotifications.NotificationContent();
            content.Title            = "Calendar - Date";
            content.Subtitle         = "Subtitle_";
            content.Body             = "Body_";
            content.Badge            = 1;
            content.UserInfo ["404"] = 1;

            var dateComponents = new SA.IOSNative.UserNotifications.DateComponents()
            {
                Second = 32,
                Year   = 2017,
                Month  = 6,
                Day    = 6,
                Hour   = 13,
                Minute = 01
                         //             You can use any of this fields or their combination; In this example, trigger will fire every Friday, every 32nd second

                         //			public int? Year;
                         //			public int? Month;
                         //			public int? Day;
                         //			public int? Hour;
                         //			public int? Minute;
                         //			public int? Second;
                         //			public int? Weekday; (1 - Sunday, 7 - Saturday)
                         //			public int? Quarter;
            };

            var trigger = new SA.IOSNative.UserNotifications.CalendarTrigger(dateComponents);
            var request = new SA.IOSNative.UserNotifications.NotificationRequest("some0id2", content, trigger);

            SA.IOSNative.UserNotifications.NotificationCenter.AddNotificationRequest(request, (result) => {
                ISN_Logger.Log("request callback");
                ISN_Logger.Log(result.ToString());
            });
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel All User Notifications"))
        {
            SA.IOSNative.UserNotifications.NotificationCenter.CancelAllNotifications();
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Cancel some0id2"))
        {
            SA.IOSNative.UserNotifications.NotificationCenter.CancelUserNotificationById("some0id2");
        }

        StartX += XButtonStep;
        if (UnityEngine.GUI.Button(new UnityEngine.Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Pending UserNotifications"))
        {
            SA.IOSNative.UserNotifications.NotificationCenter.GetPendingNotificationRequests(requests => {
                for (int i = 0; i < requests.Count; i++)
                {
                    ISN_Logger.Log(requests[i].Content.Title);
                }
            });
        }
    }