Exemplo n.º 1
0
        public static void Init(PlatformConfig platformConfig, HmdPeripheral hmd)
        {
            if (GetCallMade())
            {
                return;
            }

            Log.Debug("[Init] " + platformConfig);

            (new GameObject("OneTimeCall")).AddComponent <OneTimeCall>().Send(platformConfig, hmd);
        }
Exemplo n.º 2
0
        public static void Init(PlatformConfig platformConfig)
        {
            if (platformConfig == null)
            {
                return;
            }
            if (isInited == false)
            {
                isInited = true;

                // creating SwrveManager instance
                GameObject go = (GameObject)Object.Instantiate(Resources.Load(ANALYTICS_SERVICE_NAME));
                go.name = ANALYTICS_SERVICE_NAME;

                // setting config for push notifications
                SwrveComponent.Instance.Config.PushNotificationEnabled = true;

                // additional initialization for Android
                                #if UNITY_ANDROID
                SwrveComponent.Instance.Config.GCMSenderId = platformConfig.Sender;
                SwrveComponent.Instance.Config.GCMPushNotificationTitle = platformConfig.Title;
                                #endif

                // initializing Swrve
                SwrveManager.instance.InitWithAnalyticsKeySecret(int.Parse(platformConfig.Id), platformConfig.Key);

                // setting log level for Swrve
                SwrveLog.Level = SwrveLog.LogLevel.Disabled;

                // getting Analytics gameobject
                GameObject analytics = new GameObject("Analytics");

                Object.DontDestroyOnLoad(analytics);

                // setting parent of SwrveManager to Analytics gameobject
                go.transform.SetParent(analytics.transform);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Send the call.
        /// </summary>
        private void Send(PlatformConfig platformConfig, HmdPeripheral hmd)
        {
            if (hmd == null || !hmd.Connected)
            {
                return;
            }

            int handle = XDevicePlugin.GetInputDeviceHandle("VRDevice");

            const string SDKVersion   = "3.0";
            const string DeviceIDType = "HMD SN";
            string       DeviceID     = XDevicePlugin.GetString(handle,
                                                                XDevicePlugin.kField_HMDSN8Object,
                                                                "HMD-SerialNumber-MISSING");
            string OsVersion = XDevicePlugin.GetString(handle,
                                                       XDevicePlugin.kField_FirmwareRevisionObject,
                                                       "HMD-FirmwareVersion-MISSING");
            string Language = Application.systemLanguage.ToString();
            string Country  = Language;

            if (System.Globalization.RegionInfo.CurrentRegion != null)
            {
                Country = System.Globalization.RegionInfo.CurrentRegion.TwoLetterISORegionName;
            }
            string DeviceModel = hmd.GetModelName();

            if (string.IsNullOrEmpty(DeviceModel))
            {
                DeviceModel = "HMD-ModelName-MISSING";
            }
            const string Manufacturer = "Lenovo";
            string       Resolution   = Screen.width.ToString() + "x" + Screen.height.ToString();
            string       BundleID     = BundleVersion.Get();
            string       BundleCode   = Application.isEditor ? "1" : BundleVersion.Get(false);
            string       Channel      = (Application.platform == RuntimePlatform.Android) ? "Google Play" : "iTunes";

            string message = "HLog" + separator +
                             SDKVersion + separator +
                             DeviceIDType + separator +
                             DeviceID + separator +
                             platformConfig.Key + separator +
                             OsVersion + separator +
                             Language + separator +
                             Country + separator +
                             DeviceModel + separator +
                             Manufacturer + separator +
                             Resolution + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" +
                             "\n" +
                             BundleID + separator +
                             BundleCode + separator +
                             Channel +

                             // extra junk that OTC wants
                             "\n" +
                             "NULL" + separator +
                             "0" + separator +
                             "0" + separator +
                             "0" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "NULL" + separator +
                             "0" + separator +
                             "0" + separator +
                             "0" + separator +
                             "0" + separator +
                             "NULL\u0003" +
                             "NULL\u0002" +
                             "NULL\u0003" +
                             "NULL";

            if (testCall)
            {
                Log.Debug(message);
            }

            StartCoroutine(Upload(message, platformConfig));

            ForceVisionAnalytics.LogOneTimeCall(DeviceID, Channel, Country, BundleCode, OsVersion, SDKVersion);
        }