Example #1
0
        /// <summary>
        /// iOS,Androidそれぞれの端末登録を行う
        /// </summary>
        /// <param name="usePush">true:プッシュ通知有効 false:プッシュ通知無効</param>
        /// <param name="useAnalytics">true:開封通知有効 false:開封通知無効</param>
        /// <param name="androidSenderId">Android SenderId</param>
        /// <param name="getLocation">true:位置情報有効 false:位置情報無効</param>
        private static void RegisterPush(bool usePush, bool useAnalytics, String androidSenderId, bool getLocation = false)
        {
            //Push関連設定
            _usePush         = usePush;
            _useAnalytics    = useAnalytics;
            _androidSenderId = androidSenderId;

            // Register
            if (usePush)
            {
                //Installation基本情報を取得
                NCMBManager.CreateInstallationProperty();
                if (!getLocation)
                {
                    #if UNITY_ANDROID
                    NCMBPush.Register(androidSenderId);
                    #elif UNITY_IOS
                    NCMBPush.Register(useAnalytics);
                    #endif
                }
                else
                {
                    #if UNITY_ANDROID
                    //not Analytics
                    NCMBPush.RegisterWithLocation(androidSenderId);
                    #elif UNITY_IOS
                    NCMBPush.RegisterWithLocation();
                    #endif
                }
            }
        }
Example #2
0
 //SaveAsync通信後の処理
 internal override void _afterSave(int statusCode, NCMBException error)
 {
     if (error != null)
     {
         if (error.ErrorCode == "E404001")
         {
             //No data available時にcurrentInstallationを削除
             NCMBManager.DeleteCurrentInstallation(NCMBManager.SearchPath());
         }
     }
     else if (statusCode == 201 || statusCode == 200)
     {
         string path = NCMBManager.SearchPath();
         if (path != NCMBSettings.currentInstallationPath)
         {
             //成功時にv1のファイルを削除
             NCMBManager.DeleteCurrentInstallation(path);
         }
         _saveInstallationToDisk("currentInstallation");
     }
 }
Example #3
0
        /// <summary>
        /// 現在の配信端末情報を取得します。
        /// </summary>
        /// <returns>配信端末情報 </returns>
        public static NCMBInstallation getCurrentInstallation()
        {
            NCMBInstallation currentInstallation = null;

            try {
                //ローカルファイルに配信端末情報があれば取得、なければ新規作成
                string currentInstallationData = NCMBManager.GetCurrentInstallation();
                if (currentInstallationData != "")
                {
                    //ローカルファイルから端末情報を取得
                    currentInstallation = new NCMBInstallation(currentInstallationData);
                }
                else
                {
                    currentInstallation = new NCMBInstallation();
                }
            } catch (SystemException error) {
                throw new NCMBException(error);
            }
            return(currentInstallation);
        }
 /// <summary>
 /// 現在の配信端末情報を取得します。
 /// </summary>
 /// <returns>配信端末情報 </returns>
 public static NCMBInstallation getCurrentInstallation()
 {
     NCMBInstallation currentInstallation = null;
     try {
         //null check
         NCMBManager manager = new NCMBManager ();
         //ローカルファイルに配信端末情報があれば取得、なければ新規作成
         string currentInstallationData = manager.GetCurrentInstallation ();
         if (currentInstallationData != "") {
             //ローカルファイルから端末情報を取得
             currentInstallation = new NCMBInstallation (currentInstallationData);
         } else {
             currentInstallation = new NCMBInstallation ();
         }
     } catch (SystemException error) {
         throw new NCMBException (error);
     }
     return currentInstallation;
 }