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
        /// <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.º 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)
        {
            // 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();
        }