// Delegate from Unity

        public void OnApplicationPause(bool pauseStatus)
        {
#if UNITY_WSA && !UNITY_EDITOR
#else
            EngagementWrapper.onApplicationPause(pauseStatus);
#endif
        }
        public static void Initialize()
        {
#if UNITY_EDITOR
#elif UNITY_WSA
            //    Logging("Initialize");
#elif UNITY_IPHONE
            EngagementWrapper.initializeEngagement(Instance().name);
#elif UNITY_ANDROID
            string connectionString = EngagementConfiguration.ANDROID_CONNECTION_STRING;
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentException("ANDROID_CONNECTION_STRING cannot be null");
            }
            EngagementWrapper.registerApp(
                Instance().name,
                connectionString,
                (int)EngagementConfiguration.LOCATION_REPORTING_TYPE,
                (int)EngagementConfiguration.LOCATION_REPORTING_MODE,
                EngagementConfiguration.ENABLE_PLUGIN_LOG
                );
#endif
            hasBeenInitialized = true;
#if UNITY_WSA && !UNITY_EDITOR
            processURI();
#endif
        }
        public static void RestoreUserPreferences()
        {
#if UNITY_WSA && !UNITY_EDITOR
#else
            EngagementWrapper.restoreUserPreferences();
#endif
        }
        public static void SetEnabled(bool _enable)
        {
#if UNITY_WSA && !UNITY_EDITOR
#else
            EngagementWrapper.setEnabled(_enable);
#endif
        }
        public static void EndJob(string _jobName)
        {
            Logging("endJob:" + _jobName);
#if UNITY_WSA && !UNITY_EDITOR
            Microsoft.Azure.Engagement.EngagementAgent.Instance.EndJob(_jobName);
#else
            EngagementWrapper.endJob(_jobName);
#endif
        }
        public static void EndActivity()
        {
            Logging("endActivity");
#if UNITY_WSA && !UNITY_EDITOR
            Microsoft.Azure.Engagement.EngagementAgent.Instance.EndActivity();
#else
            EngagementWrapper.endActivity();
#endif
        }
        public static void SendJobError(string _errorName, string _jobName, Dictionary <object, object> _extraInfos = null)
        {
            Logging("SendJobError:" + _errorName + ", Job: " + _jobName);
#if UNITY_WSA && !UNITY_EDITOR
            Microsoft.Azure.Engagement.EngagementAgent.Instance.SendJobError(_errorName, _jobName, _extraInfos);
#else
            string extraInfosJSON = MiniJSON.Json.Serialize(_extraInfos);
            EngagementWrapper.sendJobError(_errorName, _jobName, extraInfosJSON);
#endif
        }
        public static void SendAppInfo(Dictionary <object, object> _extraInfos)
        {
            Logging("sendAppInfo");
#if UNITY_WSA && !UNITY_EDITOR
            Microsoft.Azure.Engagement.EngagementAgent.Instance.SendAppInfo(_extraInfos);
#else
            string extraInfosJSON = MiniJSON.Json.Serialize(_extraInfos);
            EngagementWrapper.sendAppInfo(extraInfosJSON);
#endif
        }
        public static void StartActivity(string _activityName, Dictionary <object, object> _extraInfos = null)
        {
            Logging("startActivity:" + _activityName);
#if UNITY_WSA && !UNITY_EDITOR
            Microsoft.Azure.Engagement.EngagementAgent.Instance.StartActivity(_activityName, _extraInfos);
#else
            string _extraInfosJSON = MiniJSON.Json.Serialize(_extraInfos);
            EngagementWrapper.startActivity(_activityName, _extraInfosJSON);
#endif
        }
Beispiel #10
0
        public static void Initialize( )
        {
            EngagementAgent.Logging("Initializing Reach");

            if (EngagementConfiguration.ENABLE_REACH == false)
            {
                Debug.LogError("Reach must be enabled in configuration first");
                return;
            }

            if (EngagementAgent.hasBeenInitialized == false)
            {
                Debug.LogError("Agent must be initialized before initializing Reach");
                return;
            }
#if UNITY_WSA && !UNITY_EDITOR
#else
            EngagementWrapper.initializeReach();
#endif
        }
        public static void GetStatus(Action <Dictionary <string, object> > _onStatusReceived)
        {
            if (_onStatusReceived == null)
            {
                Debug.LogError("_onStatusReceived cannot be null");
            }
            else
            {
#if UNITY_WSA && !UNITY_EDITOR
                Dictionary <string, object> status = new Dictionary <string, object>();
                status.Add("deviceId", Microsoft.Azure.Engagement.EngagementAgent.Instance.GetDeviceId());
                status.Add("pluginVersion", EngagementAgent.PLUGIN_VERSION);
                status.Add("nativeVersion", "3.4.0");
                status.Add("isEnabled", true);
                _onStatusReceived(status);
#else
                Instance().onStatusReceivedDelegate = _onStatusReceived;
                EngagementWrapper.getStatus();
#endif
            }
        }