RegisterForNotifications() public static method

Register to receive local and remote notifications of the specified types from a provider via Apple Push Service.

public static RegisterForNotifications ( NotificationType notificationTypes ) : void
notificationTypes NotificationType Notification types to register for.
return void
コード例 #1
0
 public static void RegisterNotificationSettings()
 {
     NotificationServices.RegisterForNotifications(
         NotificationType.Alert |
         NotificationType.Badge |
         NotificationType.Sound);
 }
コード例 #2
0
 public void InitIOS()
 {
     Notification.RegisterForNotifications(
         NotificationType.Alert |
         NotificationType.Badge |
         NotificationType.Sound);
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("ctrAnalyticsClass start");



        //local notification for iOS
        //tokenSent = false;
#if UNITY_IOS
        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);
#endif


        //AppsFlyer
        /* Mandatory - set your AppsFlyer’s Developer key. */
        Debug.Log("AppsFlyer init");
        AppsFlyer.setAppsFlyerKey("Ura5UVbFB3YXvaig2PnvPA");
        /* For detailed logging */

        //AppsFlyer.setIsDebug (true);
#if UNITY_IOS
        /* Mandatory - set your apple app ID
         * NOTE: You should enter the number only and not the "ID" prefix */
        AppsFlyer.setAppID("1440167499");
        AppsFlyer.trackAppLaunch();
#elif UNITY_ANDROID
        /* Mandatory - set your Android package name */
        AppsFlyer.setAppID("com.evogames.feedthespider");
        /* For getting the conversion data in Android, you need to add the "AppsFlyerTrackerCallbacks" listener.*/
        AppsFlyer.init("Ura5UVbFB3YXvaig2PnvPA", "AppsFlyerTrackerCallbacks");
#endif
    }
コード例 #4
0
 public void RequireNotificationsPremissions()
 {
     DontAskForNotifications();
     NotificationServices.RegisterForNotifications(
         NotificationType.Alert |
         NotificationType.Badge |
         NotificationType.Sound);
 }
コード例 #5
0
        private void RequestRegistreNotifications()
        {
            // iOS
#if UNITY_IOS
            Debug.Log("Request Notifications iOS");
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
#endif
        }
コード例 #6
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
 }
コード例 #7
0
    void Awake()
    {
#if UNITY_IOS
        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);
#endif
    }
コード例 #8
0
//public class LocalNoticeScript {

    // Use this for initialization
    void Start()
    {
                #if UNITY_IOS
        NotificationServices.RegisterForNotifications(
            UnityEngine.iOS.NotificationType.Alert |
            UnityEngine.iOS.NotificationType.Badge |
            UnityEngine.iOS.NotificationType.Sound
            );
                #endif
    }
コード例 #9
0
    void Start()
    {
        sendNotif = 7;
        tokenSent = false;

        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);
    }
コード例 #10
0
    void Start()
    {
                #if UNITY_IOS
        // Register for iOS local notifications
        Debug.Log("Registering iOS notifications");
        NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
#endif

        // Schedule notification on start
        ScheduleLocalNotification();
    }
コード例 #11
0
        public IEnumerator AskForPermissionsCoroutine()
        {
            yield return(new WaitForSeconds(popupCloseDelay));

#if UNITY_ANDROID // 1. RegisterForNotifications via manifest
            // 2. Assuming it's allowed on install

            //analyticsController.SendNotificationPermissionsResult(true);
#elif UNITY_IOS
            NotificationServices.RegisterForNotifications(
                NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
            StartCoroutine(CheckForiOSPermissionOutcome());
#endif
        }
コード例 #12
0
        private IEnumerator Start()
        {
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound, true);

            int retryCount = 0;

            while (this.deviceToken == null)
            {
                if (this.deviceToken == null && NotificationServices.deviceToken != null)
                {
                    this.deviceToken = BitConverter.ToString(NotificationServices.deviceToken).Replace("-", "").ToLower();
                }

                retryCount++;

                if (retryCount > RetryCountMax)
                {
                    yield break;
                }

                yield return(new WaitForSeconds(RetryWaitTime));
            }

            // if we got here and still no deviceToken, then we timed out
            if (this.deviceToken == null)
            {
                Debug.LogError("PlayFabIOSPushHandler timed out waiting for the deviceToken.");

                // cleaning up this iOS push notification handler so it doesn't take up any cycles
                GameObject.Destroy(this);
                yield break;
            }

            PlayFabClientAPI.RegisterForIOSPushNotification(
                new RegisterForIOSPushNotificationRequest {
                DeviceToken = this.deviceToken
            },
                (result) =>
            {
                Debug.Log("Push Notification Registration Successful!");
            },
                (error) =>
            {
                Debug.Log("Error Registering for iOS Push Notifications!");
                Debug.Log(error.Error);
                Debug.Log(error.ErrorMessage);
                Debug.Log(error.ErrorDetails);
            });
        }
コード例 #13
0
        public IEnumerator AskForPermissionsCoroutine()
        {
            print("[NOTIFICATION] Ask permissions");

            yield return(new WaitForSeconds(postGameWindowClosedDelay));

#if UNITY_ANDROID // 1. RegisterForNotifications via manifest
            // 2. Assuming it's allowed on install

            //analyticsController.SendNotificationPermissionsResult(true);
#elif UNITY_IOS
            NotificationServices.RegisterForNotifications(
                NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
#endif
        }
コード例 #14
0
        private void RegisterForToken()
        {
            if (mIsFetchingToken)
            {
                return;
            }

            mIsFetchingToken = true;

            if (!Application.isMobilePlatform || Application.isEditor)
            {
                SetDebugText("Platform unsupported for push noticiations");
            }
            else
            {
                SetDebugText("Register for token - Begin");

#if UNITY_ANDROID || UNITY_EDITOR
                // Firebase is dependant on Google Services. Prompt user to install/update if unavailable.
                FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(
                    task =>
                {
                    DependencyStatus dependencyStatus = task.Result;

                    if (dependencyStatus == DependencyStatus.Available)
                    {
                        FirebaseMessaging.TokenReceived += OnGetFirebaseToken;
                        FirebaseMessaging.Subscribe("TestTopic");
                    }
                    else
                    {
                        OnRegisterFail("Could not resolve all Firebase dependencies: " + dependencyStatus);
                    }
                });
#endif

#if UNITY_IPHONE || UNITY_EDITOR
                NotificationServices.RegisterForNotifications(
                    NotificationType.Alert |
                    NotificationType.Badge |
                    NotificationType.Sound);

                StartCoroutine(WaitForIOSToken());
#endif
                SetDebugText("Register for token - Waiting");
            }
        }
コード例 #15
0
    void Awake()
    {
        if (Application.isEditor)
        {
            Application.runInBackground = true;
        }
        this.enabled          = false;
        UIManager.onShowPage += LevelMapPopup;
        rate_it_showed        = PlayerPrefs.GetInt("Rated") == 1;

        #if UNITY_IOS
        NotificationServices.RegisterForNotifications(
            UnityEngine.iOS.NotificationType.Alert |
            UnityEngine.iOS.NotificationType.Badge |
            UnityEngine.iOS.NotificationType.Sound);
        #endif

        RemoveAllNotifications();
        UpdateNotifications();
    }
コード例 #16
0
    void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;
        DontDestroyOnLoad(gameObject);

        Debug.Log("ctrNotificationClass start");
        cancelNotification();
        //local notification for iOS
        //tokenSent = false;
#if UNITY_IOS
        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);
#endif
    }
コード例 #17
0
    void Start()
    {
        Events.OnChallengeCreate  += OnChallengeCreate;
        Events.OnChallengeClose   += OnChallengeClose;
        Events.OnChallengeRemind  += OnChallengeRemind;
        Events.SendNotificationTo += SendNotificationTo;

        if (PlayerPrefs.HasKey("currentInstallation"))
        {
            string objId = PlayerPrefs.GetString("currentInstallation");
            currentInstallation = ParseObject.CreateWithoutData("_Installation", objId);
        }

        if (currentInstallation == null)
        {
#if UNITY_IPHONE && !UNITY_EDITOR
            NotificationServices.RegisterForNotifications(
                NotificationType.Alert |
                NotificationType.Badge |
                NotificationType.Sound);
#endif
        }
    }
コード例 #18
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    IEnumerator Start()
    {
#if UNITY_IPHONE && !UNITY_EDITOR
        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);

        // notification clear
        NativeRecieveManager.RemotePushClear();
#endif


        //ローディングアニメーション取得。
        _loadAnimation.SetActive(true);
        //アプリ全体で使用する変数をリセット。
        ResetStaticVariable();

        //仮登録API ----------------------
        new PreRegistUser();
        while (PreRegistUser._success == false)
        {
            yield return(PreRegistUser._success == true);
        }

        _userKey = PreRegistUser._httpCatchData.result.user.user_key;
        _gender  = PreRegistUser._httpCatchData.result.user.sex_cd;

        new GetUserApi();
        while (GetUserApi._success == false)
        {
            yield return(GetUserApi._success == true);
        }

        //-------------------------------- 広告用設定 初期化処理 ここから --------------------------------
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
        if (GetUserApi._httpCatchData.result.review == "false")
        {
            string nendNativeAdApiKey_IOS = "";
            string nendNativeAdSpotId_IOS = "";

            string nendNativeAdApiKey_Android = "";
            string nendNativeAdSpotId_Android = "";

            if (CommonConstants.IS_AD_TEST == true)
            {
                //Imobile Test mode
                IMobileSdkAdsUnityPlugin.setTestMode(true);

                //Maio test mode
                Maio.SetAdTestMode(true);

                //バナー広告用 テスト
                IMobileSdkAdsUnityPlugin.registerInline(
                    CommonConstants.IMOBILE_PARTNER_TEST_ID,
                    CommonConstants.IMOBILE_MDDIA_TEST_ID,
                    CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID
                    );

                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_TEST_ID,
                    CommonConstants.IMOBILE_MDDIA_TEST_ID,
                    CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID
                    );

                //スポット情報の取得処理
                //バナー広告用テスト
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID);

                //インタースティシャル広告テスト
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);

                //NEND IOS用 テスト
                nendNativeAdApiKey_IOS = CommonConstants.NEND_NATIVEAD_API_TEST_ID;
                nendNativeAdSpotId_IOS = CommonConstants.NEND_NATIVEAD_SPOT_TEST_ID;

                //NEND Android用 テスト
                nendNativeAdApiKey_Android = CommonConstants.NEND_NATIVEAD_API_TEST_ID;
                nendNativeAdSpotId_Android = CommonConstants.NEND_NATIVEAD_SPOT_TEST_ID;
            }
            else
            {
                // //バナー広告用
                IMobileSdkAdsUnityPlugin.registerInline(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_BANNER_SPOT_ID
                    );

                //インタースティシャル用
                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID
                    );

                //フル広告用
                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_FULL_SPOT_ID
                    );

                //スポット情報の取得処理
                //インタースティシャル
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);

                //バナー
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_BANNER_SPOT_ID);

                //アイモバイル・フル広告用
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_FULL_SPOT_ID);

                //NEND Native AD IOS
                nendNativeAdApiKey_IOS = CommonConstants.NEND_NATIVEAD_API_IOS_ID;
                nendNativeAdSpotId_IOS = CommonConstants.NEND_NATIVEAD_SPOT_IOS_ID;

                //NEND Native AD ANDROID
                nendNativeAdApiKey_Android = CommonConstants.NEND_NATIVEAD_API_ANDROID_ID;
                nendNativeAdSpotId_Android = CommonConstants.NEND_NATIVEAD_SPOT_ANDROID_ID;
            }



            //Nend Native Ad セットアップ処理。
                        #if UNITY_EDITOR
            // UnityEditorの場合は、広告枠のタイプを指定しテスト用の広告を使って表示の確認が行えます。
            m_NendAdClient    = NativeAdClientFactory.NewClient(NativeAdClientFactory.NativeAdType.SmallSquare);
            m_NendAdFullBoard = NendAdFullBoard.NewFullBoardAd(CommonConstants.NEND_NATIVEFULL_SPOT_IOS_ID, CommonConstants.NEND_NATIVEFULL_API_IOS_ID);
                        #elif UNITY_IPHONE
            m_NendAdClient    = NativeAdClientFactory.NewClient(nendNativeAdSpotId_IOS, nendNativeAdApiKey_IOS);
            m_NendAdFullBoard = NendAdFullBoard.NewFullBoardAd(CommonConstants.NEND_NATIVEFULL_SPOT_IOS_ID, CommonConstants.NEND_NATIVEFULL_API_IOS_ID);
                        #elif UNITY_ANDROID
            m_NendAdClient = NativeAdClientFactory.NewClient(nendNativeAdSpotId_Android, nendNativeAdApiKey_Android);
//m_NendAdFullBoard  = NativeAdClientFactory.NewClient (nendNativeAdSpotId_Android, nendNativeAdApiKey_Android);
                        #endif

            //バナー広告用。
            IMobileSdkAdsUnityPlugin.inlinieAdOrientation = IMobileSdkAdsUnityPlugin.ImobileSdkAdsInlineAdOrientation.PORTRAIT;


            //maio動画広告のクローズボタンが押された時のイベント処理。
            Maio.OnClosedAd += MaioMovieSdkEvent.OnClosed;

            //動画 広告用。
            Maio.Start(CommonConstants.MAIO_MEDIA_ID);

            NendAdBannerOrigenalManager.Instance.Init();
        }
#endif
//-------------------------------- 広告用設定 初期化処理 ここまで--------------------------------

        //メンテナンスの場合、処理を止める。
        if (AppliEventController.Instance.MaintenanceCheck() == true)
        {
            _loadAnimation.SetActive(false);
            yield break;
        }

        //ユーザーのステータスをチェックする処理。
        AppliEventController.Instance.UserStatusProblem();

        //強制アップデートの場合、処理を止める。
        if (AppliEventController.Instance.ForceUpdateCheck() == true)
        {
            _loadAnimation.SetActive(false);
            yield break;
        }

        //GPSを取得する処理。
        yield return(StartCoroutine(GpsSet()));

#if UNITY_IPHONE && !UNITY_EDITOR
        NativeRecieveManager.GetPushMessageIos();
#endif
        _tokenSent         = false;
        _toPushCatchUserId = "";

#if UNITY_ANDROID
        //ステータスバーを表示 //Android用
        ApplicationChrome.statusBarState = ApplicationChrome.States.VisibleOverContent;
#endif


        //基本プロフィールを作成しているかどうかの判定。
        if (string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.name) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.pref) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.city_id) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.birth_date) == false)
        {
            //基本プロフィールを作成している。
            _isBaseProfile = true;
        }
        else
        {
            //まだ、基本プロフィールを作成していない。
            _isBaseProfile = false;
        }

        //サーバーにイベント通知用Api(インストール時に一回のみ) ----------------------
        _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME;

        LocalFileHandler.Init(_commonFileName);

        //ファイルが作成されるまでポーリングして処理待ち
        while (System.IO.File.Exists(_commonFileName) == false)
        {
            yield return(System.IO.File.Exists(_commonFileName) == true);
        }

        //ここでユーザーキーを保存
        LocalFileHandler.SetString(LocalFileConstants.USER_KEY, _userKey);
        LocalFileHandler.Flush();

        //レビュー時、すれ違い機能は表示しないようにしておく。リスクヘッジ。


#if UNITY_ANDROID && !UNITY_EDITOR
        _deviceToken = GCMService.GetRegistrationId();

        //デバイストークンの登録API----------------------
        if (string.IsNullOrEmpty(_deviceToken) == false)
        {
            new SetDeviceToken(_userKey, _deviceToken);
            while (SetDeviceToken._success == false)
            {
                yield return(SetDeviceToken._success == true);
            }
        }
        else
        {
            GCMService.Registration();
        }
#endif

        //初期マスターデータの取得
        //ファイルネーム比較してマスター更新分があったら再度Api飛ばしてローカルデータを更新する
        new InitDataApi();
        while (InitDataApi._success == false)
        {
            yield return(InitDataApi._success == true);
        }

        //新着メッセージ未既読のAPI取得する
        new GetUnreadMessageCountApi();
        while (GetUnreadMessageCountApi._success == false)
        {
            yield return(GetUnreadMessageCountApi._success == true);
        }
        _msgBadge = GetUnreadMessageCountApi._httpCatchData.result.count;

        var user = PreRegistUser._httpCatchData.result.user;

        if (string.IsNullOrEmpty(user.pref) == false && string.IsNullOrEmpty(user.city_id) == false &&
            user.pref != "0" && user.city_id != "0")
        {
            if (PreRegistUser._httpCatchData.result.complete.Count > 0)
            {
                //Mypageシーンに遷移 - 遷移する前にログインボーナス表示
                string loginComplete = PreRegistUser._httpCatchData.result.complete [0];
                if (string.IsNullOrEmpty(loginComplete) == false)
                {
                    StartEventManager.Instance.PanelPopupAnimate(_loginBonus);
                    _loginBonus.transform.GetChild(0).localScale = new Vector3(1, 1, 1);
                    _loadAnimation.SetActive(false);
                    yield break;
                }
                else
                {
                    _loadAnimation.SetActive(false);
                    NextSceneProccess();
                    yield break;
                }
            }
            else
            {
                _loadAnimation.SetActive(false);
                NextSceneProccess();
                yield break;
            }
        }
        else
        {
            if (_gender != "0")
            {
                NextSceneProccess();
                yield break;
            }

#if !UNITY_EDITOR && UNITY_IPHONE
            //初回時に通る処理。 => ポップアップ
            //説明用ポップアップ。
            PopupSecondSelectPanel.Instance.PopMessageInsert(
                LocalMsgConst.SELF_SHARE_INFO_CONFIRM,
                LocalMsgConst.APPROVAL,
                LocalMsgConst.DENIAL,
                PublicUserInfoAllow,
                PublicUserInfoDeny
                );
            GameObject obj = GameObject.FindGameObjectWithTag(CommonConstants.POPUP_SECOND_SELECT_TAG);
            StartEventManager.Instance.PanelPopupAnimate(obj);
#endif

            if (string.IsNullOrEmpty(LocalFileHandler.GetString(LocalFileConstants.VALID_URL_KEY)) == true)
            {
                if (GetUserApi._httpCatchData.result.review == "false")
                {
                    new Valid(_userKey);
                    while (Valid._success == false)
                    {
                        yield return(Valid._success == true);
                    }

                    //start app installed. defaul browser open
                    if (string.IsNullOrEmpty(Valid._httpCatchData.result.url) == false)
                    {
                        //ローカルファイルにvalid_urlで保存 初回インストール時のみ通知するURLとする
                        LocalFileHandler.SetString(LocalFileConstants.VALID_URL_KEY, Valid._httpCatchData.result.url);
                        LocalFileHandler.Flush();
                        var uri = new System.Uri(Valid._httpCatchData.result.url);
                        Application.OpenURL(uri.AbsoluteUri);
                    }
                }
            }
            LocalFileHandler.HashAllClear();


            _startAnimation.GetComponent <uTweenPosition> ().enabled = true;
            _loadAnimation.SetActive(false);
        }
    }
コード例 #19
0
 void Awake()
 {
     NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
     OCBridge.ClearLocalNotification();
 }
コード例 #20
0
        //----- params -----

        //----- field -----

        //----- property -----

        //----- method -----

        public void PlatformInitialize()
        {
            var notificationTypes = NotificationType.Alert | NotificationType.Badge | NotificationType.Sound;

            NotificationServices.RegisterForNotifications(notificationTypes);
        }
コード例 #21
0
        public void Setup(object data = null)
        {
#if UNITY_IOS
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound, registerForRemote: true);
#endif
        }
コード例 #22
0
 public static void Register(bool registerForRemote = false)
 {
             #if UNITY_IOS
     NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound, registerForRemote);
             #endif
 }
コード例 #23
0
 /// <summary>
 ///   <para>Register to receive local and remote notifications of the specified types from a provider via Apple Push Service.</para>
 /// </summary>
 /// <param name="notificationTypes">Notification types to register for.</param>
 /// <param name="registerForRemote">Specify true to also register for remote notifications.</param>
 public static void RegisterForNotifications(NotificationType notificationTypes)
 {
     NotificationServices.RegisterForNotifications(notificationTypes, true);
 }