Beispiel #1
0
        void Awake()
        {
            appToken = TinySauce.getToken();


            if (appToken == "")
            {
                throw new MissingFieldException("Go here", new Exception("No Adjust token found please add it to your tinysauce settings"));
                Debug.Break();
                return;
            }
            if (IsEditor())
            {
                return;
            }

            DontDestroyOnLoad(transform.gameObject);

            if (!this.startManually)
            {
                AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress));
                adjustConfig.setLogLevel(this.logLevel);
                adjustConfig.setSendInBackground(this.sendInBackground);
                adjustConfig.setEventBufferingEnabled(this.eventBuffering);
                adjustConfig.setLaunchDeferredDeeplink(this.launchDeferredDeeplink);
                Adjust.start(adjustConfig);
            }
        }
Beispiel #2
0
        public void start(AdjustConfig adjustConfig)
        {
            string logLevelString = null;
            string environment    = lowercaseToString(adjustConfig.environment);
            Action <Dictionary <string, string> > attributionChangedDictionary = null;

            if (adjustConfig.logLevel.HasValue)
            {
                logLevelString = lowercaseToString(adjustConfig.logLevel.Value);
            }

            if (adjustConfig.attributionChangedDelegate != null)
            {
                attributionChangedDictionary = (attributionDictionary) => Adjust.runAttributionChangedDictionary(attributionDictionary);
            }
#if UNITY_WSA_10_0
            AdjustWS10.ApplicationLaunching(
#elif UNITY_WINRT_8_1
                AdjustWS81.ApplicationLaunching(
#endif
                appToken: adjustConfig.appToken,
                logLevelString: logLevelString,
                environment: environment,
                defaultTracker: adjustConfig.defaultTracker,
                eventBufferingEnabled: adjustConfig.eventBufferingEnabled,
                sdkPrefix: sdkPrefix,
                attributionChangedDic: attributionChangedDictionary,
                logDelegate: adjustConfig.logDelegate
                );
        }
        public void start(AdjustConfig adjustConfig)
        {
            AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject> ("ENVIRONMENT_SANDBOX") :
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject> ("ENVIRONMENT_PRODUCTION");

            AndroidJavaObject ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);

            if (adjustConfig.logLevel != null)
            {
                AndroidJavaObject ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject> (adjustConfig.logLevel.ToString().ToUpper());

                if (ajoLogLevel != null)
                {
                    ajoAdjustConfig.Call("setLogLevel", ajoLogLevel);
                }
            }

            if (adjustConfig.attributionChangedDelegate != null)
            {
                onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                ajoAdjustConfig.Call("setOnAttributionChangedListener", onAttributionChangedListener);
            }

            ajoAdjustConfig.Call("setSdkPrefix", sdkPrefix);

            // Since INSTALL_REFERRER is not triggering SDK initialisation, call onResume after onCreate.
            // OnApplicationPause doesn't get called first time the scene loads, so call to onResume is needed.

            ajcAdjust.CallStatic("onCreate", ajoAdjustConfig);
            ajcAdjust.CallStatic("onResume");
        }
        void Awake()
        {
            if (Adjust.instance != null)
            {
                return;
            }

            DontDestroyOnLoad(transform.gameObject);

            if (!this.startManually)
            {
                AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment);
                adjustConfig.setLogLevel(this.logLevel);
                adjustConfig.setEventBufferingEnabled(eventBuffering);

                if (printAttribution)
                {
                    adjustConfig.setEventSuccessDelegate(EventSuccessCallback);
                    adjustConfig.setEventFailureDelegate(EventFailureCallback);
                    adjustConfig.setSessionSuccessDelegate(SessionSuccessCallback);
                    adjustConfig.setSessionFailureDelegate(SessionFailureCallback);
                    adjustConfig.setAttributionChangedDelegate(AttributionChangedCallback);
                }

                Adjust.start(adjustConfig);
            }
        }
Beispiel #5
0
 // Token: 0x06000071 RID: 113 RVA: 0x00003E18 File Offset: 0x00002218
 private void Awake()
 {
     if (Adjust.instance != null)
     {
         return;
     }
     UnityEngine.Object.DontDestroyOnLoad(base.transform.gameObject);
     if (!this.startManually)
     {
         AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment, this.logLevel == AdjustLogLevel.Suppress);
         adjustConfig.setLogLevel(this.logLevel);
         adjustConfig.setSendInBackground(this.sendInBackground);
         adjustConfig.setEventBufferingEnabled(this.eventBuffering);
         adjustConfig.setLaunchDeferredDeeplink(this.launchDeferredDeeplink);
         if (this.printAttribution)
         {
             adjustConfig.setEventSuccessDelegate(new Action <AdjustEventSuccess>(this.EventSuccessCallback), "Adjust");
             adjustConfig.setEventFailureDelegate(new Action <AdjustEventFailure>(this.EventFailureCallback), "Adjust");
             adjustConfig.setSessionSuccessDelegate(new Action <AdjustSessionSuccess>(this.SessionSuccessCallback), "Adjust");
             adjustConfig.setSessionFailureDelegate(new Action <AdjustSessionFailure>(this.SessionFailureCallback), "Adjust");
             adjustConfig.setDeferredDeeplinkDelegate(new Action <string>(this.DeferredDeeplinkCallback), "Adjust");
             adjustConfig.setAttributionChangedDelegate(new Action <AdjustAttribution>(this.AttributionChangedCallback), "Adjust");
         }
         Adjust.start(adjustConfig);
     }
 }
Beispiel #6
0
 // Token: 0x06000073 RID: 115 RVA: 0x00003F60 File Offset: 0x00002360
 public static void start(AdjustConfig adjustConfig)
 {
     if (Adjust.instance != null)
     {
         Debug.Log("adjust: Error, SDK already started.");
         return;
     }
     if (adjustConfig == null)
     {
         Debug.Log("adjust: Missing config to start.");
         return;
     }
     Adjust.instance = new AdjustAndroid();
     if (Adjust.instance == null)
     {
         Debug.Log("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps.");
         return;
     }
     Adjust.eventSuccessDelegate       = adjustConfig.getEventSuccessDelegate();
     Adjust.eventFailureDelegate       = adjustConfig.getEventFailureDelegate();
     Adjust.sessionSuccessDelegate     = adjustConfig.getSessionSuccessDelegate();
     Adjust.sessionFailureDelegate     = adjustConfig.getSessionFailureDelegate();
     Adjust.deferredDeeplinkDelegate   = adjustConfig.getDeferredDeeplinkDelegate();
     Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate();
     Adjust.instance.start(adjustConfig);
 }
Beispiel #7
0
        public void start(AdjustConfig adjustConfig)
        {
            AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject> ("ENVIRONMENT_SANDBOX") :
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject> ("ENVIRONMENT_PRODUCTION");

            AndroidJavaObject ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);

            if (adjustConfig.logLevel != null)
            {
                AndroidJavaObject ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject> (adjustConfig.logLevel.ToString().ToUpper());

                if (ajoLogLevel != null)
                {
                    ajoAdjustConfig.Call("setLogLevel", ajoLogLevel);
                }
            }

            if (adjustConfig.attributionChangedDelegate != null)
            {
                onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                ajoAdjustConfig.Call("setOnAttributionChangedListener", onAttributionChangedListener);
            }

            ajoAdjustConfig.Call("setSdkPrefix", adjustConfig.sdkPrefix);

            ajcAdjust.CallStatic("onCreate", ajoAdjustConfig);
        }
Beispiel #8
0
        void Awake()
        {
            if (Adjust.instance != null)
            {
                return;
            }

            DontDestroyOnLoad(transform.gameObject);

            if (!this.startManually)
            {
                AdjustConfig adjustConfig;

                adjustConfig = new AdjustConfig(this.appToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress));

                adjustConfig.setLogLevel(this.logLevel);
                adjustConfig.setSendInBackground(this.sendInBackground);
                adjustConfig.setEventBufferingEnabled(this.eventBuffering);
                adjustConfig.setLaunchDeferredDeeplink(this.launchDeferredDeeplink);

                if (printAttribution)
                {
                    adjustConfig.setEventSuccessDelegate(EventSuccessCallback);
                    adjustConfig.setEventFailureDelegate(EventFailureCallback);
                    adjustConfig.setSessionSuccessDelegate(SessionSuccessCallback);
                    adjustConfig.setSessionFailureDelegate(SessionFailureCallback);
                    adjustConfig.setDeferredDeeplinkDelegate(DeferredDeeplinkCallback);
                    adjustConfig.setAttributionChangedDelegate(AttributionChangedCallback);
                }

                Adjust.start(adjustConfig);
            }
        }
Beispiel #9
0
        public static void start(AdjustConfig adjustConfig)
        {
            if (IsEditor())
            {
                return;
            }

            if (adjustConfig == null)
            {
                Debug.Log("Adjust: Missing config to start.");
                return;
            }

            #if UNITY_IOS
            Adjust.eventSuccessDelegate       = adjustConfig.getEventSuccessDelegate();
            Adjust.eventFailureDelegate       = adjustConfig.getEventFailureDelegate();
            Adjust.sessionSuccessDelegate     = adjustConfig.getSessionSuccessDelegate();
            Adjust.sessionFailureDelegate     = adjustConfig.getSessionFailureDelegate();
            Adjust.deferredDeeplinkDelegate   = adjustConfig.getDeferredDeeplinkDelegate();
            Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate();
            AdjustiOS.Start(adjustConfig);
            #elif UNITY_ANDROID
            AdjustAndroid.Start(adjustConfig);
            #elif (UNITY_WSA || UNITY_WP8)
            AdjustWindows.Start(adjustConfig);
            #else
            Debug.Log(errorMsgPlatform);
            #endif
        }
Beispiel #10
0
        public static void start(AdjustConfig adjustConfig)
        {
            if (Adjust.instance != null)
            {
                Debug.Log("adjust: Error, SDK already started.");
                return;
            }

            if (adjustConfig == null)
            {
                Debug.Log("adjust: Missing config to start.");
                return;
            }

                        #if UNITY_EDITOR
            Adjust.instance = null;
                        #elif UNITY_IOS
            Adjust.instance = new AdjustiOS();
                        #elif UNITY_ANDROID
            Adjust.instance = new AdjustAndroid();
                        #else
            Adjust.instance = null;
                        #endif

            if (Adjust.instance == null)
            {
                Debug.Log("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps.");
                return;
            }

            adjustConfig.setSdkPrefix(Adjust.sdkPrefix);
            Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate();

            Adjust.instance.start(adjustConfig);
        }
Beispiel #11
0
        public void start(AdjustConfig adjustConfig)
        {
            AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
                new AndroidJavaClass ("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject> ("ENVIRONMENT_SANDBOX") :
                    new AndroidJavaClass ("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject> ("ENVIRONMENT_PRODUCTION");

            AndroidJavaObject ajoAdjustConfig = new AndroidJavaObject ("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);

            if (adjustConfig.logLevel != null) {
                AndroidJavaObject ajoLogLevel = new AndroidJavaClass ("com.adjust.sdk.LogLevel").GetStatic<AndroidJavaObject> (adjustConfig.logLevel.ToString().ToUpper());

                if (ajoLogLevel != null) {
                    ajoAdjustConfig.Call ("setLogLevel", ajoLogLevel);
                }
            }

            if (adjustConfig.attributionChangedDelegate != null) {
                onAttributionChangedListener = new AttributionChangeListener (adjustConfig.attributionChangedDelegate);
                ajoAdjustConfig.Call ("setOnAttributionChangedListener", onAttributionChangedListener);
            }

            ajoAdjustConfig.Call ("setSdkPrefix", adjustConfig.sdkPrefix);

            ajcAdjust.CallStatic ("onCreate", ajoAdjustConfig);
        }
Beispiel #12
0
        public void start(AdjustConfig adjustConfig)
        {
            string logLevelString = null;
            string environment    = adjustConfig.environment.lowercaseToString();
            Action <Dictionary <string, string> > attributionChangedDictionary = null;

            if (adjustConfig.logLevel != null)
            {
                logLevelString = adjustConfig.logLevel.lowercaseToString();
            }

            if (adjustConfig.attributionChangedDelegate != null)
            {
                attributionChangedDictionary = (attributionDictionary) => Adjust.runAttributionChangedDictionary(attributionDictionary);
            }

            AdjustWP.ApplicationLaunching(
                appToken: adjustConfig.appToken,
                logLevelString: logLevelString,
                environment: environment,
                defaultTracker: adjustConfig.defaultTracker,
                eventBufferingEnabled: adjustConfig.eventBufferingEnabled,
                sdkPrefix: sdkPrefix,
                attributionChangedDic: attributionChangedDictionary,
                logDelegate: adjustConfig.logDelegate
                );
        }
Beispiel #13
0
        public static void start(AdjustConfig adjustConfig)
        {
            if (Adjust.instance != null) {
                Debug.Log ("adjust: Error, SDK already started.");
                return;
            }

            if (adjustConfig == null) {
                Debug.Log ("adjust: Missing config to start.");
                return;
            }

            #if UNITY_EDITOR
                Adjust.instance = null;
            #elif UNITY_IOS
                Adjust.instance = new AdjustiOS();
            #elif UNITY_ANDROID
                Adjust.instance = new AdjustAndroid();
            #else
                Adjust.instance = null;
            #endif

            if (Adjust.instance == null) {
                Debug.Log ("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps.");
                return;
            }

            adjustConfig.setSdkPrefix(Adjust.sdkPrefix);
            Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate ();

            Adjust.instance.start (adjustConfig);
        }
Beispiel #14
0
 // Private & helper methods.
 private static bool IsAppSecretSet(AdjustConfig adjustConfig)
 {
     return(adjustConfig.secretId.HasValue &&
            adjustConfig.info1.HasValue &&
            adjustConfig.info2.HasValue &&
            adjustConfig.info3.HasValue &&
            adjustConfig.info4.HasValue);
 }
Beispiel #15
0
        public static void Start(AdjustConfig adjustConfig)
        {
            string appToken                              = adjustConfig.appToken != null ? adjustConfig.appToken : "ADJ_INVALID";
            string sceneName                             = adjustConfig.sceneName != null ? adjustConfig.sceneName : "ADJ_INVALID";
            string userAgent                             = adjustConfig.userAgent != null ? adjustConfig.userAgent : "ADJ_INVALID";
            string defaultTracker                        = adjustConfig.defaultTracker != null ? adjustConfig.defaultTracker : "ADJ_INVALID";
            string externalDeviceId                      = adjustConfig.externalDeviceId != null ? adjustConfig.externalDeviceId : "ADJ_INVALID";
            string environment                           = adjustConfig.environment.ToLowercaseString();
            long   info1                                 = AdjustUtils.ConvertLong(adjustConfig.info1);
            long   info2                                 = AdjustUtils.ConvertLong(adjustConfig.info2);
            long   info3                                 = AdjustUtils.ConvertLong(adjustConfig.info3);
            long   info4                                 = AdjustUtils.ConvertLong(adjustConfig.info4);
            long   secretId                              = AdjustUtils.ConvertLong(adjustConfig.secretId);
            double delayStart                            = AdjustUtils.ConvertDouble(adjustConfig.delayStart);
            int    logLevel                              = AdjustUtils.ConvertLogLevel(adjustConfig.logLevel);
            int    isDeviceKnown                         = AdjustUtils.ConvertBool(adjustConfig.isDeviceKnown);
            int    sendInBackground                      = AdjustUtils.ConvertBool(adjustConfig.sendInBackground);
            int    eventBufferingEnabled                 = AdjustUtils.ConvertBool(adjustConfig.eventBufferingEnabled);
            int    allowiAdInfoReading                   = AdjustUtils.ConvertBool(adjustConfig.allowiAdInfoReading);
            int    allowIdfaReading                      = AdjustUtils.ConvertBool(adjustConfig.allowIdfaReading);
            int    allowSuppressLogLevel                 = AdjustUtils.ConvertBool(adjustConfig.allowSuppressLogLevel);
            int    launchDeferredDeeplink                = AdjustUtils.ConvertBool(adjustConfig.launchDeferredDeeplink);
            int    isAttributionCallbackImplemented      = AdjustUtils.ConvertBool(adjustConfig.getAttributionChangedDelegate() != null);
            int    isEventSuccessCallbackImplemented     = AdjustUtils.ConvertBool(adjustConfig.getEventSuccessDelegate() != null);
            int    isEventFailureCallbackImplemented     = AdjustUtils.ConvertBool(adjustConfig.getEventFailureDelegate() != null);
            int    isSessionSuccessCallbackImplemented   = AdjustUtils.ConvertBool(adjustConfig.getSessionSuccessDelegate() != null);
            int    isSessionFailureCallbackImplemented   = AdjustUtils.ConvertBool(adjustConfig.getSessionFailureDelegate() != null);
            int    isDeferredDeeplinkCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getDeferredDeeplinkDelegate() != null);

            _AdjustLaunchApp(
                appToken,
                environment,
                sdkPrefix,
                userAgent,
                defaultTracker,
                externalDeviceId,
                sceneName,
                allowSuppressLogLevel,
                logLevel,
                isDeviceKnown,
                eventBufferingEnabled,
                sendInBackground,
                allowiAdInfoReading,
                allowIdfaReading,
                secretId,
                info1,
                info2,
                info3,
                info4,
                delayStart,
                launchDeferredDeeplink,
                isAttributionCallbackImplemented,
                isEventSuccessCallbackImplemented,
                isEventFailureCallbackImplemented,
                isSessionSuccessCallbackImplemented,
                isSessionFailureCallbackImplemented,
                isDeferredDeeplinkCallbackImplemented);
        }
Beispiel #16
0
        public void start(AdjustConfig adjustConfig)
        {
            string appToken    = adjustConfig.appToken;
            string sceneName   = adjustConfig.sceneName;
            string environment = adjustConfig.environment.lowercaseToString();

            int logLevel = AdjustUtils.ConvertLogLevel(adjustConfig.logLevel);
            int eventBufferingEnabled = AdjustUtils.ConvertBool(adjustConfig.eventBufferingEnabled);

            _AdjustLaunchApp(appToken, environment, sdkPrefix, logLevel, eventBufferingEnabled, sceneName);
        }
Beispiel #17
0
        public void start(AdjustConfig adjustConfig)
        {
            string appToken = adjustConfig .appToken;
            string sdkPrefix = adjustConfig.sdkPrefix;
            string sceneName = adjustConfig.sceneName;
            string environment = adjustConfig.environment.ToString ().ToLower ();

            int logLevel = convertLogLevel (adjustConfig.logLevel);
            int eventBufferingEnabled = convertBool (adjustConfig.eventBufferingEnabled);

            _AdjustLaunchApp (appToken, environment, sdkPrefix, logLevel, eventBufferingEnabled, sceneName);
        }
Beispiel #18
0
        public void start(AdjustConfig adjustConfig)
        {
            string appToken    = adjustConfig.appToken;
            string sceneName   = adjustConfig.sceneName;
            string environment = adjustConfig.environment.ToString().ToLower();

            int logLevel = convertLogLevel(adjustConfig.logLevel);
            int eventBufferingEnabled = convertBool(adjustConfig.eventBufferingEnabled);
            int macMd5TrackingEnabled = convertBool(adjustConfig.macMd5TrackingEnabled);

            _AdjustLaunchApp(appToken, environment, sdkPrefix, logLevel, eventBufferingEnabled, macMd5TrackingEnabled, sceneName);
        }
Beispiel #19
0
 public static void start(AdjustConfig adjustConfig)
 {
     if (Adjust.IsEditor())
     {
         return;
     }
     if (adjustConfig == null)
     {
         UnityEngine.Debug.Log("Adjust: Missing config to start.");
         return;
     }
     AdjustAndroid.Start(adjustConfig);
 }
Beispiel #20
0
        public void StartWithCurrentParameters()
        {
            AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment);

            adjustConfig.setLogLevel(this.logLevel);
            adjustConfig.setEventBufferingEnabled(eventBuffering);

            if (printAttribution)
            {
                adjustConfig.setAttributionChangedDelegate(responseDelegate);
            }

            Adjust.start(adjustConfig);
        }
Beispiel #21
0
 public static void start(AdjustConfig adjustConfig)
 {
     if (!IsEditor())
     {
         if (adjustConfig == null)
         {
             UnityEngine.Debug.Log("Adjust: Missing config to start.");
         }
         else
         {
             AdjustAndroid.Start(adjustConfig);
         }
     }
 }
Beispiel #22
0
 private void Awake()
 {
     if (!IsEditor())
     {
         UnityEngine.Object.DontDestroyOnLoad(base.transform.gameObject);
         if (!startManually)
         {
             AdjustConfig adjustConfig = new AdjustConfig(appToken, environment, logLevel == AdjustLogLevel.Suppress);
             adjustConfig.setLogLevel(logLevel);
             adjustConfig.setSendInBackground(sendInBackground);
             adjustConfig.setEventBufferingEnabled(eventBuffering);
             adjustConfig.setLaunchDeferredDeeplink(launchDeferredDeeplink);
             start(adjustConfig);
         }
     }
 }
Beispiel #23
0
        void Awake()
        {
            if (!Application.isEditor)
            {
                DontDestroyOnLoad(transform.gameObject);

                if (!this.startManually)
                {
                    AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress));
                    adjustConfig.setLogLevel(this.logLevel);
                    adjustConfig.setSendInBackground(this.sendInBackground);
                    adjustConfig.setEventBufferingEnabled(this.eventBuffering);
                    adjustConfig.setLaunchDeferredDeeplink(this.launchDeferredDeeplink);
                    Adjust.start(adjustConfig);
                }
            }
        }
Beispiel #24
0
 private void Awake()
 {
     if (Adjust.IsEditor())
     {
         return;
     }
     UnityEngine.Object.DontDestroyOnLoad(base.transform.gameObject);
     if (!this.startManually)
     {
         AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment, this.logLevel == AdjustLogLevel.Suppress);
         adjustConfig.setLogLevel(this.logLevel);
         adjustConfig.setSendInBackground(this.sendInBackground);
         adjustConfig.setEventBufferingEnabled(this.eventBuffering);
         adjustConfig.setLaunchDeferredDeeplink(this.launchDeferredDeeplink);
         Adjust.start(adjustConfig);
     }
 }
Beispiel #25
0
        public void start(AdjustConfig adjustConfig)
        {
            string appToken    = adjustConfig.appToken;
            string sceneName   = adjustConfig.sceneName;
            string userAgent   = adjustConfig.userAgent != null ? adjustConfig.userAgent : String.Empty;
            string environment = adjustConfig.environment.lowercaseToString();

            double delayStart = AdjustUtils.ConvertDouble(adjustConfig.delayStart);

            int logLevel               = AdjustUtils.ConvertLogLevel(adjustConfig.logLevel);
            int sendInBackground       = AdjustUtils.ConvertBool(adjustConfig.sendInBackground);
            int eventBufferingEnabled  = AdjustUtils.ConvertBool(adjustConfig.eventBufferingEnabled);
            int allowSuppressLogLevel  = AdjustUtils.ConvertBool(adjustConfig.allowSuppressLogLevel);
            int launchDeferredDeeplink = AdjustUtils.ConvertBool(adjustConfig.launchDeferredDeeplink);

            _AdjustLaunchApp(appToken, environment, sdkPrefix, allowSuppressLogLevel, logLevel, eventBufferingEnabled, sendInBackground, delayStart, userAgent, launchDeferredDeeplink, sceneName);
        }
Beispiel #26
0
        void Awake()
        {
            DontDestroyOnLoad(transform.gameObject);

            if (!this.startManually)
            {
                AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment);
                adjustConfig.setLogLevel(this.logLevel);
                adjustConfig.setEventBufferingEnabled(eventBuffering);

                if (printAttribution)
                {
                    adjustConfig.setAttributionChangedDelegate(responseDelegate);
                }

                Adjust.start(adjustConfig);
            }
        }
Beispiel #27
0
        public static void start(AdjustConfig adjustConfig)
        {
            if (Adjust.instance != null)
            {
                Debug.Log("adjust: Error, SDK already started.");
                return;
            }

            if (adjustConfig == null)
            {
                Debug.Log("adjust: Missing config to start.");
                return;
            }

            #if UNITY_EDITOR
            Adjust.instance = null;
            #elif UNITY_IOS
            Adjust.instance = new AdjustiOS();
            #elif UNITY_ANDROID
            Adjust.instance = new AdjustAndroid();
            #elif UNITY_WP8
            Adjust.instance = new AdjustWP8();
            #elif UNITY_METRO
            Adjust.instance = new AdjustMetro();
            #else
            Adjust.instance = null;
            #endif

            if (Adjust.instance == null)
            {
                Debug.Log("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps.");
                return;
            }

            Adjust.eventSuccessDelegate       = adjustConfig.getEventSuccessDelegate();
            Adjust.eventFailureDelegate       = adjustConfig.getEventFailureDelegate();
            Adjust.sessionSuccessDelegate     = adjustConfig.getSessionSuccessDelegate();
            Adjust.sessionFailureDelegate     = adjustConfig.getSessionFailureDelegate();
            Adjust.deferredDeeplinkDelegate   = adjustConfig.getDeferredDeeplinkDelegate();
            Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate();

            Adjust.instance.start(adjustConfig);
        }
Beispiel #28
0
        public void start(AdjustConfig adjustConfig)
        {
            string appToken    = adjustConfig.appToken;
            string sceneName   = adjustConfig.sceneName;
            string userAgent   = adjustConfig.userAgent != null ? adjustConfig.userAgent : String.Empty;
            string environment = adjustConfig.environment.lowercaseToString();

            double delayStart = AdjustUtils.ConvertDouble(adjustConfig.delayStart);

            int logLevel               = AdjustUtils.ConvertLogLevel(adjustConfig.logLevel);
            int sendInBackground       = AdjustUtils.ConvertBool(adjustConfig.sendInBackground);
            int eventBufferingEnabled  = AdjustUtils.ConvertBool(adjustConfig.eventBufferingEnabled);
            int allowSuppressLogLevel  = AdjustUtils.ConvertBool(adjustConfig.allowSuppressLogLevel);
            int launchDeferredDeeplink = AdjustUtils.ConvertBool(adjustConfig.launchDeferredDeeplink);

            int isAttributionCallbackImplemented      = AdjustUtils.ConvertBool(adjustConfig.getAttributionChangedDelegate() != null);
            int isEventSuccessCallbackImplemented     = AdjustUtils.ConvertBool(adjustConfig.getEventSuccessDelegate() != null);
            int isEventFailureCallbackImplemented     = AdjustUtils.ConvertBool(adjustConfig.getEventFailureDelegate() != null);
            int isSessionSuccessCallbackImplemented   = AdjustUtils.ConvertBool(adjustConfig.getSessionSuccessDelegate() != null);
            int isSessionFailureCallbackImplemented   = AdjustUtils.ConvertBool(adjustConfig.getSessionFailureDelegate() != null);
            int isDeferredDeeplinkCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getDeferredDeeplinkDelegate() != null);

            _AdjustLaunchApp(
                appToken,
                environment,
                sdkPrefix,
                allowSuppressLogLevel,
                logLevel,
                eventBufferingEnabled,
                sendInBackground,
                delayStart,
                userAgent,
                launchDeferredDeeplink,
                sceneName,
                isAttributionCallbackImplemented,
                isEventSuccessCallbackImplemented,
                isEventFailureCallbackImplemented,
                isSessionSuccessCallbackImplemented,
                isSessionFailureCallbackImplemented,
                isDeferredDeeplinkCallbackImplemented);
        }
Beispiel #29
0
        public void start(AdjustConfig adjustConfig)
        {
            string logLevelString = null;
            if (adjustConfig.logLevel != null)
            {
                logLevelString = adjustConfig.logLevel.ToString();
            }

            Action<Dictionary<string, string>> attributionChangedDictionary = null;
            if (adjustConfig.attributionChangedDelegate != null)
            {
                attributionChangedDictionary = (attributionDictionary) => Adjust.runAttributionChangedDictionary(attributionDictionary);
            }

            AdjustWP.ApplicationLaunching (
                appToken: adjustConfig.appToken,
                logLevelString: logLevelString,
                environment: adjustConfig.environment.ToString ().ToLower (),
                defaultTracker: adjustConfig.defaultTracker,
                eventBufferingEnabled: adjustConfig.eventBufferingEnabled,
                sdkPrefix: sdkPrefix,
                attributionChangedDic: attributionChangedDictionary
            );
        }
Beispiel #30
0
        public static void Start(AdjustConfig adjustConfig)
        {
            // Thank you, Unity 2019.2.0, for breaking this.
            // AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
            //     new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("ENVIRONMENT_SANDBOX") :
            //         new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("ENVIRONMENT_PRODUCTION");

            // Get environment variable.
            string ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Production ? "production" : "sandbox";

            // Create adjust config object.
            AndroidJavaObject ajoAdjustConfig;

            // Check if suppress log leve is supported.
            if (adjustConfig.allowSuppressLogLevel != null)
            {
                ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment, adjustConfig.allowSuppressLogLevel);
            }
            else
            {
                ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);
            }

            // Check if deferred deeplink should be launched by SDK.
            launchDeferredDeeplink = adjustConfig.launchDeferredDeeplink;

            // Check log level.
            if (adjustConfig.logLevel != null)
            {
                AndroidJavaObject ajoLogLevel;
                if (adjustConfig.logLevel.Value.ToUppercaseString().Equals("SUPPRESS"))
                {
                    ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>("SUPRESS");
                }
                else
                {
                    ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>(adjustConfig.logLevel.Value.ToUppercaseString());
                }

                if (ajoLogLevel != null)
                {
                    ajoAdjustConfig.Call("setLogLevel", ajoLogLevel);
                }
            }

            // Set unity SDK prefix.
            ajoAdjustConfig.Call("setSdkPrefix", sdkPrefix);

            // Check if user has configured the delayed start option.
            if (adjustConfig.delayStart != null)
            {
                ajoAdjustConfig.Call("setDelayStart", adjustConfig.delayStart);
            }

            // Check event buffering setting.
            if (adjustConfig.eventBufferingEnabled != null)
            {
                AndroidJavaObject ajoIsEnabled = new AndroidJavaObject("java.lang.Boolean", adjustConfig.eventBufferingEnabled.Value);
                ajoAdjustConfig.Call("setEventBufferingEnabled", ajoIsEnabled);
            }

            // Check if user enabled tracking in the background.
            if (adjustConfig.sendInBackground != null)
            {
                ajoAdjustConfig.Call("setSendInBackground", adjustConfig.sendInBackground.Value);
            }

            // Check if user wants to get cost data in attribution callback.
            if (adjustConfig.needsCost != null)
            {
                ajoAdjustConfig.Call("setNeedsCost", adjustConfig.needsCost.Value);
            }

            // Check if user wants to run preinstall campaigns.
            if (adjustConfig.preinstallTrackingEnabled != null)
            {
                ajoAdjustConfig.Call("setPreinstallTrackingEnabled", adjustConfig.preinstallTrackingEnabled.Value);
            }

            // Check if user has set user agent value.
            if (adjustConfig.userAgent != null)
            {
                ajoAdjustConfig.Call("setUserAgent", adjustConfig.userAgent);
            }

            // Check if user has set default process name.
            if (!String.IsNullOrEmpty(adjustConfig.processName))
            {
                ajoAdjustConfig.Call("setProcessName", adjustConfig.processName);
            }

            // Check if user has set default tracker token.
            if (adjustConfig.defaultTracker != null)
            {
                ajoAdjustConfig.Call("setDefaultTracker", adjustConfig.defaultTracker);
            }

            // Check if user has set external device identifier.
            if (adjustConfig.externalDeviceId != null)
            {
                ajoAdjustConfig.Call("setExternalDeviceId", adjustConfig.externalDeviceId);
            }

            // Check if user has set custom URL strategy.
            if (adjustConfig.urlStrategy != null)
            {
                if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyChina)
                {
                    AndroidJavaObject ajoUrlStrategyChina = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("URL_STRATEGY_CHINA");
                    ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyChina);
                }
                else if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyIndia)
                {
                    AndroidJavaObject ajoUrlStrategyIndia = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("URL_STRATEGY_INDIA");
                    ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyIndia);
                }
                else if (adjustConfig.urlStrategy == AdjustConfig.AdjustDataResidencyEU)
                {
                    AndroidJavaObject ajoDataResidencyEU = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("DATA_RESIDENCY_EU");
                    ajoAdjustConfig.Call("setUrlStrategy", ajoDataResidencyEU);
                }
            }

            // Check if user has set app secret.
            if (IsAppSecretSet(adjustConfig))
            {
                ajoAdjustConfig.Call("setAppSecret",
                                     adjustConfig.secretId.Value,
                                     adjustConfig.info1.Value,
                                     adjustConfig.info2.Value,
                                     adjustConfig.info3.Value,
                                     adjustConfig.info4.Value);
            }

            // Check if user has set device as known.
            if (adjustConfig.isDeviceKnown.HasValue)
            {
                ajoAdjustConfig.Call("setDeviceKnown", adjustConfig.isDeviceKnown.Value);
            }

            // Check if user has enabled reading of IMEI and MEID.
            // Obsolete method.
            if (adjustConfig.readImei.HasValue)
            {
                // ajoAdjustConfig.Call("setReadMobileEquipmentIdentity", adjustConfig.readImei.Value);
            }

            // Check attribution changed delagate setting.
            if (adjustConfig.attributionChangedDelegate != null)
            {
                onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                ajoAdjustConfig.Call("setOnAttributionChangedListener", onAttributionChangedListener);
            }

            // Check event success delegate setting.
            if (adjustConfig.eventSuccessDelegate != null)
            {
                onEventTrackingSucceededListener = new EventTrackingSucceededListener(adjustConfig.eventSuccessDelegate);
                ajoAdjustConfig.Call("setOnEventTrackingSucceededListener", onEventTrackingSucceededListener);
            }

            // Check event failure delagate setting.
            if (adjustConfig.eventFailureDelegate != null)
            {
                onEventTrackingFailedListener = new EventTrackingFailedListener(adjustConfig.eventFailureDelegate);
                ajoAdjustConfig.Call("setOnEventTrackingFailedListener", onEventTrackingFailedListener);
            }

            // Check session success delegate setting.
            if (adjustConfig.sessionSuccessDelegate != null)
            {
                onSessionTrackingSucceededListener = new SessionTrackingSucceededListener(adjustConfig.sessionSuccessDelegate);
                ajoAdjustConfig.Call("setOnSessionTrackingSucceededListener", onSessionTrackingSucceededListener);
            }

            // Check session failure delegate setting.
            if (adjustConfig.sessionFailureDelegate != null)
            {
                onSessionTrackingFailedListener = new SessionTrackingFailedListener(adjustConfig.sessionFailureDelegate);
                ajoAdjustConfig.Call("setOnSessionTrackingFailedListener", onSessionTrackingFailedListener);
            }

            // Check deferred deeplink delegate setting.
            if (adjustConfig.deferredDeeplinkDelegate != null)
            {
                onDeferredDeeplinkListener = new DeferredDeeplinkListener(adjustConfig.deferredDeeplinkDelegate);
                ajoAdjustConfig.Call("setOnDeeplinkResponseListener", onDeferredDeeplinkListener);
            }

            // Initialise and start the SDK.
            ajcAdjust.CallStatic("onCreate", ajoAdjustConfig);
            ajcAdjust.CallStatic("onResume");
        }
        public void start(AdjustConfig adjustConfig)
        {
            AndroidJavaObject androidJavaObject = (adjustConfig.environment != AdjustEnvironment.Sandbox) ? new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_PRODUCTION") : new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_SANDBOX");
            bool?allowSuppressLogLevel          = adjustConfig.allowSuppressLogLevel;
            AndroidJavaObject androidJavaObject2;

            if (allowSuppressLogLevel != null)
            {
                androidJavaObject2 = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", new object[]
                {
                    this.ajoCurrentActivity,
                    adjustConfig.appToken,
                    androidJavaObject,
                    adjustConfig.allowSuppressLogLevel
                });
            }
            else
            {
                androidJavaObject2 = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", new object[]
                {
                    this.ajoCurrentActivity,
                    adjustConfig.appToken,
                    androidJavaObject
                });
            }
            AdjustAndroid.launchDeferredDeeplink = adjustConfig.launchDeferredDeeplink;
            AdjustLogLevel?logLevel = adjustConfig.logLevel;

            if (logLevel != null)
            {
                AndroidJavaObject @static;
                if (adjustConfig.logLevel.Value.uppercaseToString().Equals("SUPPRESS"))
                {
                    @static = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>("SUPRESS");
                }
                else
                {
                    @static = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>(adjustConfig.logLevel.Value.uppercaseToString());
                }
                if (@static != null)
                {
                    androidJavaObject2.Call("setLogLevel", new object[]
                    {
                        @static
                    });
                }
            }
            double?delayStart = adjustConfig.delayStart;

            if (delayStart != null)
            {
                androidJavaObject2.Call("setDelayStart", new object[]
                {
                    adjustConfig.delayStart
                });
            }
            bool?eventBufferingEnabled = adjustConfig.eventBufferingEnabled;

            if (eventBufferingEnabled != null)
            {
                AndroidJavaObject androidJavaObject3 = new AndroidJavaObject("java.lang.Boolean", new object[]
                {
                    adjustConfig.eventBufferingEnabled.Value
                });
                androidJavaObject2.Call("setEventBufferingEnabled", new object[]
                {
                    androidJavaObject3
                });
            }
            bool?sendInBackground = adjustConfig.sendInBackground;

            if (sendInBackground != null)
            {
                androidJavaObject2.Call("setSendInBackground", new object[]
                {
                    adjustConfig.sendInBackground.Value
                });
            }
            if (adjustConfig.userAgent != null)
            {
                androidJavaObject2.Call("setUserAgent", new object[]
                {
                    adjustConfig.userAgent
                });
            }
            if (!string.IsNullOrEmpty(adjustConfig.processName))
            {
                androidJavaObject2.Call("setProcessName", new object[]
                {
                    adjustConfig.processName
                });
            }
            if (adjustConfig.defaultTracker != null)
            {
                androidJavaObject2.Call("setDefaultTracker", new object[]
                {
                    adjustConfig.defaultTracker
                });
            }
            if (adjustConfig.attributionChangedDelegate != null)
            {
                this.onAttributionChangedListener = new AdjustAndroid.AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                androidJavaObject2.Call("setOnAttributionChangedListener", new object[]
                {
                    this.onAttributionChangedListener
                });
            }
            if (adjustConfig.eventSuccessDelegate != null)
            {
                this.onEventTrackingSucceededListener = new AdjustAndroid.EventTrackingSucceededListener(adjustConfig.eventSuccessDelegate);
                androidJavaObject2.Call("setOnEventTrackingSucceededListener", new object[]
                {
                    this.onEventTrackingSucceededListener
                });
            }
            if (adjustConfig.eventFailureDelegate != null)
            {
                this.onEventTrackingFailedListener = new AdjustAndroid.EventTrackingFailedListener(adjustConfig.eventFailureDelegate);
                androidJavaObject2.Call("setOnEventTrackingFailedListener", new object[]
                {
                    this.onEventTrackingFailedListener
                });
            }
            if (adjustConfig.sessionSuccessDelegate != null)
            {
                this.onSessionTrackingSucceededListener = new AdjustAndroid.SessionTrackingSucceededListener(adjustConfig.sessionSuccessDelegate);
                androidJavaObject2.Call("setOnSessionTrackingSucceededListener", new object[]
                {
                    this.onSessionTrackingSucceededListener
                });
            }
            if (adjustConfig.sessionFailureDelegate != null)
            {
                this.onSessionTrackingFailedListener = new AdjustAndroid.SessionTrackingFailedListener(adjustConfig.sessionFailureDelegate);
                androidJavaObject2.Call("setOnSessionTrackingFailedListener", new object[]
                {
                    this.onSessionTrackingFailedListener
                });
            }
            if (adjustConfig.deferredDeeplinkDelegate != null)
            {
                this.onDeferredDeeplinkListener = new AdjustAndroid.DeferredDeeplinkListener(adjustConfig.deferredDeeplinkDelegate);
                androidJavaObject2.Call("setOnDeeplinkResponseListener", new object[]
                {
                    this.onDeferredDeeplinkListener
                });
            }
            androidJavaObject2.Call("setSdkPrefix", new object[]
            {
                "unity4.11.0"
            });
            AdjustAndroid.ajcAdjust.CallStatic("onCreate", new object[]
            {
                androidJavaObject2
            });
            AdjustAndroid.ajcAdjust.CallStatic("onResume", new object[0]);
        }
Beispiel #32
0
        public static void Start(AdjustConfig adjustConfig)
        {
            string logLevelString = null;
            string environment    = adjustConfig.environment.ToLowercaseString();

            Action <Dictionary <string, string> > attributionChangedAction    = null;
            Action <Dictionary <string, string> > sessionSuccessChangedAction = null;
            Action <Dictionary <string, string> > sessionFailureChangedAction = null;
            Action <Dictionary <string, string> > eventSuccessChangedAction   = null;
            Action <Dictionary <string, string> > eventFailureChangedAction   = null;
            Func <string, bool> deeplinkResponseFunc = null;

            if (adjustConfig.logLevel.HasValue)
            {
                logLevelString = adjustConfig.logLevel.Value.ToLowercaseString();
            }

            if (adjustConfig.attributionChangedDelegate != null)
            {
                attributionChangedAction = (attributionMap) =>
                {
                    var attribution = new AdjustAttribution(attributionMap);
                    adjustConfig.attributionChangedDelegate(attribution);
                };
            }

            if (adjustConfig.sessionSuccessDelegate != null)
            {
                sessionSuccessChangedAction = (sessionMap) =>
                {
                    var sessionData = new AdjustSessionSuccess(sessionMap);
                    adjustConfig.sessionSuccessDelegate(sessionData);
                };
            }

            if (adjustConfig.sessionFailureDelegate != null)
            {
                sessionFailureChangedAction = (sessionMap) =>
                {
                    var sessionData = new AdjustSessionFailure(sessionMap);
                    adjustConfig.sessionFailureDelegate(sessionData);
                };
            }

            if (adjustConfig.eventSuccessDelegate != null)
            {
                eventSuccessChangedAction = (eventMap) =>
                {
                    var eventData = new AdjustEventSuccess(eventMap);
                    adjustConfig.eventSuccessDelegate(eventData);
                };
            }

            if (adjustConfig.eventFailureDelegate != null)
            {
                eventFailureChangedAction = (eventMap) =>
                {
                    var eventData = new AdjustEventFailure(eventMap);
                    adjustConfig.eventFailureDelegate(eventData);
                };
            }

            if (adjustConfig.deferredDeeplinkDelegate != null)
            {
                deeplinkResponseFunc = uri =>
                {
                    if (adjustConfig.launchDeferredDeeplink)
                    {
                        adjustConfig.deferredDeeplinkDelegate(uri);
                    }

                    return(adjustConfig.launchDeferredDeeplink);
                };
            }

            bool sendInBackground = false;

            if (adjustConfig.sendInBackground.HasValue)
            {
                sendInBackground = adjustConfig.sendInBackground.Value;
            }

            double delayStartSeconds = 0;

            if (adjustConfig.delayStart.HasValue)
            {
                delayStartSeconds = adjustConfig.delayStart.Value;
            }

            AdjustConfigDto adjustConfigDto = new AdjustConfigDto {
                AppToken                     = adjustConfig.appToken,
                Environment                  = environment,
                SdkPrefix                    = sdkPrefix,
                SendInBackground             = sendInBackground,
                DelayStart                   = delayStartSeconds,
                UserAgent                    = adjustConfig.userAgent,
                DefaultTracker               = adjustConfig.defaultTracker,
                EventBufferingEnabled        = adjustConfig.eventBufferingEnabled,
                LaunchDeferredDeeplink       = adjustConfig.launchDeferredDeeplink,
                LogLevelString               = logLevelString,
                LogDelegate                  = adjustConfig.logDelegate,
                ActionAttributionChangedData = attributionChangedAction,
                ActionSessionSuccessData     = sessionSuccessChangedAction,
                ActionSessionFailureData     = sessionFailureChangedAction,
                ActionEventSuccessData       = eventSuccessChangedAction,
                ActionEventFailureData       = eventFailureChangedAction,
                FuncDeeplinkResponseData     = deeplinkResponseFunc,
                IsDeviceKnown                = adjustConfig.isDeviceKnown,
                SecretId                     = adjustConfig.secretId,
                Info1 = adjustConfig.info1,
                Info2 = adjustConfig.info2,
                Info3 = adjustConfig.info3,
                Info4 = adjustConfig.info4
            };

            AdjustWinInterface.ApplicationLaunching(adjustConfigDto);
            AdjustWinInterface.ApplicationActivated();
            appLaunched = true;
        }
Beispiel #33
0
    void OnGUI()
    {
        if (showPopUp) {
            GUI.Window(0, new Rect((Screen.width / 2) - 150, (Screen.height / 2) - 65, 300, 130), showGUI, "Is SDK enabled?");
        }

        if (GUI.Button (new Rect (0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtManualLaunch)) {
            if (!string.Equals(txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase)) {
                AdjustConfig adjustConfig = new AdjustConfig ("{YourAppToken}", AdjustEnvironment.Sandbox);
                adjustConfig.setLogLevel (AdjustLogLevel.Verbose);
                adjustConfig.setAttributionChangedDelegate (this.attributionChangedDelegate);

                Adjust.start (adjustConfig);
                isEnabled = true;

                txtManualLaunch = "SDK Launched";
            }
        }

        if (GUI.Button (new Rect (0, Screen.height * 1 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Simple Event")) {
            AdjustEvent adjustEvent = new AdjustEvent ("{YourEventToken}");

            Adjust.trackEvent (adjustEvent);
        }

        if (GUI.Button (new Rect (0, Screen.height * 2 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Revenue Event")) {
            AdjustEvent adjustEvent = new AdjustEvent ("{YourEventToken}");
            adjustEvent.setRevenue (0.25, "EUR");

            Adjust.trackEvent (adjustEvent);
        }

        if (GUI.Button (new Rect (0, Screen.height * 3 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Callback Event")) {
            AdjustEvent adjustEvent = new AdjustEvent ("{YourEventToken}");

            adjustEvent.addCallbackParameter ("key", "value");
            adjustEvent.addCallbackParameter ("foo", "bar");

            Adjust.trackEvent (adjustEvent);
        }

        if (GUI.Button (new Rect (0, Screen.height * 4 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Partner Event")) {
            AdjustEvent adjustEvent = new AdjustEvent ("{YourEventToken}");

            adjustEvent.addPartnerParameter ("key", "value");
            adjustEvent.addPartnerParameter ("foo", "bar");

            Adjust.trackEvent (adjustEvent);
        }

        if (GUI.Button (new Rect (0, Screen.height * 5 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtSetOfflineMode)) {
            if (string.Equals(txtSetOfflineMode, "Turn Offline Mode ON", StringComparison.OrdinalIgnoreCase)) {
                Adjust.setOfflineMode(true);

                txtSetOfflineMode = "Turn Offline Mode OFF";
            } else {
                Adjust.setOfflineMode(false);

                txtSetOfflineMode = "Turn Offline Mode ON";
            }
        }

        if (GUI.Button (new Rect (0, Screen.height * 6 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtSetEnabled)) {
            if (string.Equals(txtSetEnabled, "Disable SDK", StringComparison.OrdinalIgnoreCase)) {
                Adjust.setEnabled(false);

                txtSetEnabled = "Enable SDK";
            } else {
                Adjust.setEnabled(true);

                txtSetEnabled = "Disable SDK";
            }
        }

        if (GUI.Button (new Rect (0, Screen.height * 7 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Is SDK Enabled?")) {
            isEnabled = Adjust.isEnabled();

            showPopUp = true;
        }
    }
Beispiel #34
0
        void Awake()
        {
            DontDestroyOnLoad (transform.gameObject);

            if (!this.startManually) {
                AdjustConfig adjustConfig = new AdjustConfig (this.appToken, this.environment);
                adjustConfig.setLogLevel (this.logLevel);
                adjustConfig.setEventBufferingEnabled (eventBuffering);

                if (printAttribution) {
                    adjustConfig.setAttributionChangedDelegate (responseDelegate);
                }

                Adjust.start (adjustConfig);
            }
        }
Beispiel #35
0
        public static void Start(AdjustConfig adjustConfig)
        {
            AndroidJavaObject androidJavaObject  = (adjustConfig.environment != 0) ? new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_PRODUCTION") : new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_SANDBOX");
            bool?allowSuppressLogLevel           = adjustConfig.allowSuppressLogLevel;
            AndroidJavaObject androidJavaObject2 = (!allowSuppressLogLevel.HasValue) ? new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, androidJavaObject) : new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, androidJavaObject, adjustConfig.allowSuppressLogLevel);

            launchDeferredDeeplink = adjustConfig.launchDeferredDeeplink;
            AdjustLogLevel?logLevel = adjustConfig.logLevel;

            if (logLevel.HasValue)
            {
                AndroidJavaObject androidJavaObject3 = (!adjustConfig.logLevel.Value.ToUppercaseString().Equals("SUPPRESS")) ? new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>(adjustConfig.logLevel.Value.ToUppercaseString()) : new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>("SUPRESS");
                if (androidJavaObject3 != null)
                {
                    androidJavaObject2.Call("setLogLevel", androidJavaObject3);
                }
            }
            androidJavaObject2.Call("setSdkPrefix", "unity4.17.0");
            double?delayStart = adjustConfig.delayStart;

            if (delayStart.HasValue)
            {
                androidJavaObject2.Call("setDelayStart", adjustConfig.delayStart);
            }
            bool?eventBufferingEnabled = adjustConfig.eventBufferingEnabled;

            if (eventBufferingEnabled.HasValue)
            {
                AndroidJavaObject androidJavaObject4 = new AndroidJavaObject("java.lang.Boolean", adjustConfig.eventBufferingEnabled.Value);
                androidJavaObject2.Call("setEventBufferingEnabled", androidJavaObject4);
            }
            bool?sendInBackground = adjustConfig.sendInBackground;

            if (sendInBackground.HasValue)
            {
                androidJavaObject2.Call("setSendInBackground", adjustConfig.sendInBackground.Value);
            }
            if (adjustConfig.userAgent != null)
            {
                androidJavaObject2.Call("setUserAgent", adjustConfig.userAgent);
            }
            if (!string.IsNullOrEmpty(adjustConfig.processName))
            {
                androidJavaObject2.Call("setProcessName", adjustConfig.processName);
            }
            if (adjustConfig.defaultTracker != null)
            {
                androidJavaObject2.Call("setDefaultTracker", adjustConfig.defaultTracker);
            }
            if (IsAppSecretSet(adjustConfig))
            {
                androidJavaObject2.Call("setAppSecret", adjustConfig.secretId.Value, adjustConfig.info1.Value, adjustConfig.info2.Value, adjustConfig.info3.Value, adjustConfig.info4.Value);
            }
            if (adjustConfig.isDeviceKnown.HasValue)
            {
                androidJavaObject2.Call("setDeviceKnown", adjustConfig.isDeviceKnown.Value);
            }
            if (adjustConfig.readImei.HasValue)
            {
            }
            if (adjustConfig.attributionChangedDelegate != null)
            {
                onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                androidJavaObject2.Call("setOnAttributionChangedListener", onAttributionChangedListener);
            }
            if (adjustConfig.eventSuccessDelegate != null)
            {
                onEventTrackingSucceededListener = new EventTrackingSucceededListener(adjustConfig.eventSuccessDelegate);
                androidJavaObject2.Call("setOnEventTrackingSucceededListener", onEventTrackingSucceededListener);
            }
            if (adjustConfig.eventFailureDelegate != null)
            {
                onEventTrackingFailedListener = new EventTrackingFailedListener(adjustConfig.eventFailureDelegate);
                androidJavaObject2.Call("setOnEventTrackingFailedListener", onEventTrackingFailedListener);
            }
            if (adjustConfig.sessionSuccessDelegate != null)
            {
                onSessionTrackingSucceededListener = new SessionTrackingSucceededListener(adjustConfig.sessionSuccessDelegate);
                androidJavaObject2.Call("setOnSessionTrackingSucceededListener", onSessionTrackingSucceededListener);
            }
            if (adjustConfig.sessionFailureDelegate != null)
            {
                onSessionTrackingFailedListener = new SessionTrackingFailedListener(adjustConfig.sessionFailureDelegate);
                androidJavaObject2.Call("setOnSessionTrackingFailedListener", onSessionTrackingFailedListener);
            }
            if (adjustConfig.deferredDeeplinkDelegate != null)
            {
                onDeferredDeeplinkListener = new DeferredDeeplinkListener(adjustConfig.deferredDeeplinkDelegate);
                androidJavaObject2.Call("setOnDeeplinkResponseListener", onDeferredDeeplinkListener);
            }
            ajcAdjust.CallStatic("onCreate", androidJavaObject2);
            ajcAdjust.CallStatic("onResume");
        }
Beispiel #36
0
        public static void Start(AdjustConfig adjustConfig)
        {
            // Get environment variable.
            AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ?
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_SANDBOX") :
                                               new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic <AndroidJavaObject>("ENVIRONMENT_PRODUCTION");

            // Create adjust config object.
            AndroidJavaObject ajoAdjustConfig;

            // Check if suppress log leve is supported.
            if (adjustConfig.allowSuppressLogLevel != null)
            {
                ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment, adjustConfig.allowSuppressLogLevel);
            }
            else
            {
                ajoAdjustConfig = new AndroidJavaObject("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment);
            }

            // Check if deferred deeplink should be launched by SDK.
            launchDeferredDeeplink = adjustConfig.launchDeferredDeeplink;

            // Check log level.
            if (adjustConfig.logLevel != null)
            {
                AndroidJavaObject ajoLogLevel;

                if (adjustConfig.logLevel.Value.ToUppercaseString().Equals("SUPPRESS"))
                {
                    ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>("SUPRESS");
                }
                else
                {
                    ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.LogLevel").GetStatic <AndroidJavaObject>(adjustConfig.logLevel.Value.ToUppercaseString());
                }

                if (ajoLogLevel != null)
                {
                    ajoAdjustConfig.Call("setLogLevel", ajoLogLevel);
                }
            }

            // Check if user has configured the delayed start option.
            if (adjustConfig.delayStart != null)
            {
                ajoAdjustConfig.Call("setDelayStart", adjustConfig.delayStart);
            }

            // Check event buffering setting.
            if (adjustConfig.eventBufferingEnabled != null)
            {
                AndroidJavaObject ajoIsEnabled = new AndroidJavaObject("java.lang.Boolean", adjustConfig.eventBufferingEnabled.Value);
                ajoAdjustConfig.Call("setEventBufferingEnabled", ajoIsEnabled);
            }

            // Check if user enabled tracking in the background.
            if (adjustConfig.sendInBackground != null)
            {
                ajoAdjustConfig.Call("setSendInBackground", adjustConfig.sendInBackground.Value);
            }

            // Check if user has set user agent value.
            if (adjustConfig.userAgent != null)
            {
                ajoAdjustConfig.Call("setUserAgent", adjustConfig.userAgent);
            }

            // Check if user has set default process name.
            if (!String.IsNullOrEmpty(adjustConfig.processName))
            {
                ajoAdjustConfig.Call("setProcessName", adjustConfig.processName);
            }

            // Check if user has set default tracker token.
            if (adjustConfig.defaultTracker != null)
            {
                ajoAdjustConfig.Call("setDefaultTracker", adjustConfig.defaultTracker);
            }

            // Check attribution changed delagate setting.
            if (adjustConfig.attributionChangedDelegate != null)
            {
                onAttributionChangedListener = new AttributionChangeListener(adjustConfig.attributionChangedDelegate);
                ajoAdjustConfig.Call("setOnAttributionChangedListener", onAttributionChangedListener);
            }

            // Check event success delegate setting.
            if (adjustConfig.eventSuccessDelegate != null)
            {
                onEventTrackingSucceededListener = new EventTrackingSucceededListener(adjustConfig.eventSuccessDelegate);
                ajoAdjustConfig.Call("setOnEventTrackingSucceededListener", onEventTrackingSucceededListener);
            }

            // Check event failure delagate setting.
            if (adjustConfig.eventFailureDelegate != null)
            {
                onEventTrackingFailedListener = new EventTrackingFailedListener(adjustConfig.eventFailureDelegate);
                ajoAdjustConfig.Call("setOnEventTrackingFailedListener", onEventTrackingFailedListener);
            }

            // Check session success delegate setting.
            if (adjustConfig.sessionSuccessDelegate != null)
            {
                onSessionTrackingSucceededListener = new SessionTrackingSucceededListener(adjustConfig.sessionSuccessDelegate);
                ajoAdjustConfig.Call("setOnSessionTrackingSucceededListener", onSessionTrackingSucceededListener);
            }

            // Check session failure delegate setting.
            if (adjustConfig.sessionFailureDelegate != null)
            {
                onSessionTrackingFailedListener = new SessionTrackingFailedListener(adjustConfig.sessionFailureDelegate);
                ajoAdjustConfig.Call("setOnSessionTrackingFailedListener", onSessionTrackingFailedListener);
            }

            // Check deferred deeplink delegate setting.
            if (adjustConfig.deferredDeeplinkDelegate != null)
            {
                onDeferredDeeplinkListener = new DeferredDeeplinkListener(adjustConfig.deferredDeeplinkDelegate);
                ajoAdjustConfig.Call("setOnDeeplinkResponseListener", onDeferredDeeplinkListener);
            }

            // Set unity SDK prefix.
            ajoAdjustConfig.Call("setSdkPrefix", sdkPrefix);

            // Since INSTALL_REFERRER is not triggering SDK initialisation, call onResume after onCreate.
            // OnApplicationPause doesn't get called first time the scene loads, so call to onResume is needed.

            // Set App Secret
            if (IsAppSecretSet(adjustConfig))
            {
                ajoAdjustConfig.Call("setAppSecret",
                                     adjustConfig.secretId.Value,
                                     adjustConfig.info1.Value,
                                     adjustConfig.info2.Value,
                                     adjustConfig.info3.Value,
                                     adjustConfig.info4.Value);
            }

            // Set device known
            if (adjustConfig.isDeviceKnown.HasValue)
            {
                ajoAdjustConfig.Call("setDeviceKnown", adjustConfig.isDeviceKnown.Value);
            }

            if (adjustConfig.readImei.HasValue)
            {
                ajoAdjustConfig.Call("setReadMobileEquipmentIdentity", adjustConfig.readImei.Value);
            }

            // Initialise and start the SDK.
            ajcAdjust.CallStatic("onCreate", ajoAdjustConfig);
            ajcAdjust.CallStatic("onResume");
        }