Ejemplo n.º 1
0
        public static void ApplicationLaunching(string appToken, string environment, string logLevelString, string defaultTracker, bool?eventBufferingEnabled, string sdkPrefix, Action <Dictionary <string, string> > attributionChangedDic, Action <String> logDelegate)
        {
            LogLevel logLevel;

            if (Enum.TryParse(logLevelString, out logLevel))
            {
                Adjust.SetupLogging(logDelegate: logDelegate,
                                    logLevel: logLevel);
            }
            else
            {
                Adjust.SetupLogging(logDelegate: logDelegate);
            }

            var config = new AdjustConfig(appToken, environment);

            config.DefaultTracker = defaultTracker;

            if (eventBufferingEnabled.HasValue)
            {
                config.EventBufferingEnabled = eventBufferingEnabled.Value;
            }

            config.SdkPrefix = sdkPrefix;

            if (attributionChangedDic != null)
            {
                config.AttributionChanged = (attribution) => attributionChangedDic(attribution.ToDictionary());
            }

            Adjust.ApplicationLaunching(config);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // setup logging
            Adjust.SetupLogging(logDelegate: msg => System.Diagnostics.Debug.WriteLine(msg),
                                logLevel: LogLevel.Verbose);

            // configure Adjust
            var config = new AdjustConfig("{yourAppToken}", AdjustConfig.EnvironmentSandbox);

            // enable event buffering
            //config.EventBufferingEnabled = true;

            // set default tracker
            //config.DefaultTracker = "{YourDefaultTracker}";

            // set attribution delegate
            config.AttributionChanged = (attribution) =>
                                        System.Diagnostics.Debug.WriteLine("attribution: " + attribution);

            Adjust.ApplicationLaunching(config);

            // put the SDK in offline mode
            //Adjust.SetOfflineMode(offlineMode: true);

            // disable the SDK
            //Adjust.SetEnabled(enabled: false);

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
        }
Ejemplo n.º 3
0
        public static void ApplicationLaunching(WRTAdjustConfig adjustConfig)
        {
            if (adjustConfig.GetLogDelegate() != null)
            {
                Adjust.SetupLogging((Action <String>)adjustConfig.GetLogDelegate(), (LogLevel)adjustConfig.GetLogLevel());
            }

            adjustConfig.BuildNativeConfig();

            Adjust.ApplicationLaunching((AdjustConfig)adjustConfig.GetNativeConfig());
        }
Ejemplo n.º 4
0
        private void Start()
        {
            Config();

            var configNumber = 0;

            if (Command.ContainsParameter("configName"))
            {
                var configName = Command.GetFirstParameterValue("configName");
                configNumber = int.Parse(configName.Substring(configName.Length - 1));
            }

            var adjustConfig = _savedConfigs[configNumber];

            Adjust.ApplicationLaunching(adjustConfig);

            _savedConfigs.Remove(0);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // setup logging
            Adjust.SetupLogging(logDelegate: msg => System.Diagnostics.Debug.WriteLine(msg),
                                logLevel: LogLevel.Verbose);


            // configure Adjust
            var config = new AdjustConfig("{yourAppToken}", AdjustConfig.EnvironmentSandbox);

            // enable event buffering
            //config.EventBufferingEnabled = true;

            // set default tracker
            //config.DefaultTracker = "{YourDefaultTracker}";

            // set attribution delegate
            config.AttributionChanged = (attribution) =>
                                        System.Diagnostics.Debug.WriteLine("attribution: " + attribution);

            Adjust.ApplicationLaunching(config);

            // put the SDK in offline mode
            //Adjust.SetOfflineMode(offlineMode: true);

            // disable the SDK
            //Adjust.SetEnabled(enabled: false);
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // deprecated way of logging setup, use AdjustConfig constructor instead
            Adjust.SetupLogging(
                logDelegate: msg => System.Diagnostics.Debug.WriteLine(msg),
                logLevel: LogLevel.Verbose);

            // configure Adjust - without logging
            //var config = new AdjustConfig("{yourAppToken}", AdjustConfig.EnvironmentSandbox);

            // configure Adjust - with logging (Sandox env & Verbose log level)
            string appToken    = "2fm9gkqubvpc";
            string environment = AdjustConfig.EnvironmentSandbox;
            var    config      = new AdjustConfig(appToken, environment,
                                                  msg => Debug.WriteLine(msg), LogLevel.Verbose);

            // configure app secret (available since v4.12)
            // config.SetAppSecret(0, 1000, 3000, 4000, 5000);

            // enable event buffering
            //config.EventBufferingEnabled = true;

            // set default tracker
            //config.DefaultTracker = "{YourDefaultTracker}";

            ExampleOfVariousCallbacksSetup(config);

            // signal Adjust that the application was launched
            Adjust.ApplicationLaunching(config);

            // put the SDK in offline mode
            //Adjust.SetOfflineMode(offlineMode: true);

            // disable the SDK
            //Adjust.SetEnabled(enabled: false);
#if DEBUG
            if (Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 7
0
        public static void ApplicationLaunching(AdjustConfigDto adjustConfigDto)
        {
#if NETFX_CORE
            if (adjustConfigDto.LogDelegate != null)
            {
                LogAction = adjustConfigDto.LogDelegate;
            }

            LogLevel logLevel;
            string   logLevelString = char.ToUpper(adjustConfigDto.LogLevelString[0])
                                      + adjustConfigDto.LogLevelString.Substring(1);
            Enum.TryParse(logLevelString, out logLevel);

            //Log($"Setting log level to {logLevelString}.");

            var config = new AdjustConfig(adjustConfigDto.AppToken, adjustConfigDto.Environment,
                                          adjustConfigDto.LogDelegate, logLevel)
            {
                DefaultTracker   = adjustConfigDto.DefaultTracker,
                SdkPrefix        = adjustConfigDto.SdkPrefix,
                SendInBackground = adjustConfigDto.SendInBackground,
                DelayStart       = TimeSpan.FromSeconds(adjustConfigDto.DelayStart)
            };

            if (adjustConfigDto.SecretId.HasValue && adjustConfigDto.Info1.HasValue &&
                adjustConfigDto.Info2.HasValue && adjustConfigDto.Info3.HasValue &&
                adjustConfigDto.Info4.HasValue)
            {
                config.SetAppSecret(adjustConfigDto.SecretId.Value,
                                    adjustConfigDto.Info1.Value, adjustConfigDto.Info2.Value,
                                    adjustConfigDto.Info3.Value, adjustConfigDto.Info4.Value);
            }

            config.SetUserAgent(adjustConfigDto.UserAgent);

            if (adjustConfigDto.IsDeviceKnown.HasValue)
            {
                config.SetDeviceKnown(adjustConfigDto.IsDeviceKnown.Value);
            }

            if (adjustConfigDto.EventBufferingEnabled.HasValue)
            {
                config.EventBufferingEnabled = adjustConfigDto.EventBufferingEnabled.Value;
            }

            if (adjustConfigDto.ActionAttributionChangedData != null)
            {
                config.AttributionChanged = attribution =>
                {
                    var attributionMap = AdjustAttribution
                                         .ToDictionary(attribution)
                                         // convert from <string, object> to <string, string>
                                         .ToDictionary(
                        x => char.ToLowerInvariant(x.Key[0]) + x.Key.Substring(1),
                        x => x.Value != null ? x.Value.ToString() : "null");

                    adjustConfigDto.ActionAttributionChangedData(attributionMap);
                };
            }

            if (adjustConfigDto.ActionSessionSuccessData != null)
            {
                config.SesssionTrackingSucceeded = session =>
                                                   adjustConfigDto.ActionSessionSuccessData(Util.ToDictionary(session));
            }

            if (adjustConfigDto.ActionSessionFailureData != null)
            {
                config.SesssionTrackingFailed = session =>
                                                adjustConfigDto.ActionSessionFailureData(Util.ToDictionary(session));
            }

            if (adjustConfigDto.ActionEventSuccessData != null)
            {
                config.EventTrackingSucceeded = adjustEvent =>
                                                adjustConfigDto.ActionEventSuccessData(Util.ToDictionary(adjustEvent));
            }

            if (adjustConfigDto.ActionEventFailureData != null)
            {
                config.EventTrackingFailed = adjustEvent =>
                                             adjustConfigDto.ActionEventFailureData(Util.ToDictionary(adjustEvent));
            }

            if (adjustConfigDto.FuncDeeplinkResponseData != null)
            {
                config.DeeplinkResponse = uri =>
                                          adjustConfigDto.FuncDeeplinkResponseData(uri.AbsoluteUri);
            }

            Adjust.ApplicationLaunching(config);
#endif
        }