Esempio n. 1
0
        private async void Launched()
        {
            //create the Countly init object
            CountlySDK.CountlyCommon.CountlyBase.IsLoggingEnabled = true;
            var cc = new CountlyConfig
            {
                serverUrl  = "SERVER_URL",
                appKey     = "APP_KEY",
                appVersion = "1.2.3",
            };

            try
            {
                await Countly.Instance.Init(cc);

                await Countly.Instance.SessionBegin();

                await Countly.RecordEvent("qwedqwe");

                await Countly.Instance.RecordView("Some View");
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Some exception found!" + exception);
            }
        }
        public async void ConsentSimpleAllowedThenRemoved()
        {
            Dictionary <ConsentFeatures, bool> consentGiven   = TestHelper.AllConsentValues(true);
            Dictionary <ConsentFeatures, bool> consentRemoved = TestHelper.AllConsentValues(false);

            CountlyConfig cc = TestHelper.CreateConfig();

            cc.givenConsent              = consentGiven;
            cc.consentRequired           = true;
            Countly.Instance.deferUpload = true;
            Countly.Instance.Init(cc).Wait();
            int previousCount = Countly.Instance.Sessions.Count;

            Countly.Instance.SessionBegin().Wait();

            await Countly.Instance.SetConsent(consentRemoved);

            await Countly.Instance.SetConsent(consentGiven);

            await Countly.Instance.SetConsent(consentRemoved);

            TestHelper.ValidateDataPointUpload().Wait();
            Countly.Instance.SessionEnd().Wait();
            TestHelper.ValidateDataPointUpload().Wait();

            Assert.Equal(2 + previousCount, Countly.Instance.Sessions.Count);
            Assert.Equal(4, Countly.Instance.StoredRequests.Count);
        }
Esempio n. 3
0
        protected async override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Debug.WriteLine("Before init");

            Countly.IsLoggingEnabled = true;

            CountlyConfig countlyConfig = new CountlyConfig();

            countlyConfig.serverUrl  = serverURL;
            countlyConfig.appKey     = appKey;
            countlyConfig.appVersion = "123";

            await Countly.Instance.Init(countlyConfig);

            Countly.UserDetails.Custom.Add("aaa", "666");

            String cpuid = OpenUDID.value;
            String newId = Countly.Instance.GenerateDeviceIdMultipleFields();

            await Countly.Instance.SessionBegin();

            Debug.WriteLine("After init");
        }
Esempio n. 4
0
        public async void BasicDeserialization_002()
        {
            String targetPath = await Storage.Instance.GetFolderPath(Storage.Instance.folder) + "\\";

            String sourceFolder = TestHelper.testDataLocation + "\\SampleDataFiles\\Test_002\\";

            File.Copy(sourceFolder + "sessions.xml", targetPath + "sessions.xml", true);
            File.Copy(sourceFolder + "userdetails.xml", targetPath + "userdetails.xml", true);
            File.Copy(sourceFolder + "events.xml", targetPath + "events.xml", true);
            File.Copy(sourceFolder + "exceptions.xml", targetPath + "exceptions.xml", true);
            File.Copy(sourceFolder + "device.xml", targetPath + "device.xml", true);
            File.Copy(sourceFolder + "storedRequests.xml", targetPath + "storedRequests.xml", true);

            Countly.Instance.deferUpload = true;
            CountlyConfig cc = TestHelper.CreateConfig();
            await Countly.Instance.Init(cc);

            Assert.Equal(100, Countly.Instance.Events.Count);
            Assert.Equal(100, Countly.Instance.Exceptions.Count);
            Assert.Equal(102, Countly.Instance.Sessions.Count);
            Assert.Equal(150, Countly.Instance.StoredRequests.Count);
            Assert.Equal("SDSDSD1570501868", await Countly.GetDeviceId());

            CountlyUserDetails cud = Countly.UserDetails;

            Assert.Equal(975, cud.BirthYear);
            Assert.Equal("g", cud.Email);
            Assert.Equal("1t", cud.Gender);
            Assert.Equal("12g", cud.Name);
            Assert.Equal("12s", cud.Organization);
            Assert.Equal("1p", cud.Phone);
            Assert.Equal("12t", cud.Picture);
            Assert.Equal("1u", cud.Username);
        }
        /// <summary>
        /// Initializing Countly SDK. Must be called before any other calls
        /// </summary>
        /// <param name="config">Provide your configuration with this</param>
        /// <returns></returns>
        public override async Task Init(CountlyConfig config)
        {
            if (IsInitialized())
            {
                return;
            }

            if (config == null)
            {
                throw new InvalidOperationException("Configuration object can not be null while initializing Countly");
            }

            if (config.application != null)
            {
                //add unhandled exception handler
                IsExceptionsLoggingEnabled = true;

                config.application.UnhandledException -= OnApplicationUnhandledException;
                config.application.UnhandledException += OnApplicationUnhandledException;
            }

            await InitBase(config);

            String         unhandledExceptionValue = Storage.Instance.GetValue <string>(unhandledExceptionFilename, "");
            ExceptionEvent unhandledException      = JsonConvert.DeserializeObject <ExceptionEvent>(unhandledExceptionValue);

            if (unhandledException != null)
            {
                //add the saved unhandled exception to the other ones
                UtilityHelper.CountlyLogging("Found a stored unhandled exception, adding it the the other stored exceptions");
                Exceptions.Add(unhandledException);
                SaveExceptions();
                SaveUnhandledException(null);
            }
        }
        /// <summary>
        /// Used for testing legacy session control
        /// </summary>
        public CountlyTestCases()
        {
            CountlyImpl.SetPCLStorageIfNeeded();
            Countly.Halt();
            TestHelper.CleanDataFiles();
            CountlyConfig cc = TestHelper.CreateConfig();

            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();
        }
Esempio n. 7
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            var config = new CountlyConfig();

            config.AppKey = "eae228eb1b28f93a345d762dbb2cad3f";
            config.Host   = "https://try.count.ly";
            CountlySDK.Countly.SharedInstance().StartWithConfig(config);

            return(true);
        }
        public async void ConsentSimple()
        {
            CountlyConfig cc = TestHelper.CreateConfig();

            cc.consentRequired = true;
            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();


            TestHelper.ValidateDataPointUpload().Wait();
            Countly.Instance.SessionEnd().Wait();
            TestHelper.ValidateDataPointUpload().Wait();
        }
        /// <summary>
        /// Test setup
        /// </summary>
        public ThreadingTestCases()
        {
            threadSync = new ManualResetEvent(false);
            CountlyImpl.SetPCLStorageIfNeeded();
            Countly.Halt();
            TestHelper.CleanDataFiles();
            //Countly.Instance.deferUpload = true;

            CountlyConfig cc = TestHelper.CreateConfig();

            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();
        }
Esempio n. 10
0
        public override async Task Init(CountlyConfig config)
        {
            if (IsInitialized())
            {
                return;
            }

            if (config == null)
            {
                throw new InvalidOperationException("Configuration object can not be null while initializing Countly");
            }

            await InitBase(config);
        }
Esempio n. 11
0
        public async void SimpleControlFlow()
        {
            CountlyConfig cc = TestHelper.CreateConfig();
            await Countly.Instance.Init(cc);

            await Countly.Instance.SessionBegin();

            await Countly.Instance.SessionUpdate(10);

            Countly.Instance.lastSessionUpdateTime = DateTime.Now.AddSeconds(-10);
            await Countly.Instance.SessionEnd();

            await TestHelper.ValidateDataPointUpload();
        }
Esempio n. 12
0
        private void ConfigureCountly()
        {
            var           section = Configuration.GetSection("Countly");
            CountlyConfig cc      = new CountlyConfig();

            cc.appKey    = section["AppKey"];
            cc.serverUrl = section["ServerUrl"];
            var buildInfo = ServiceProvider.GetRequiredService <BuildInfo>();

            cc.appVersion = buildInfo.InformationalVersion;

            Countly.Instance.Init(cc);
            Countly.Instance.SessionBegin();
            Countly.IsLoggingEnabled = true;
        }
Esempio n. 13
0
        private void ConfigureCountly()
        {
            // TODO: Move metrics related things to own class.
            IConfigurationSection?section = this.Configuration.GetSection("Countly");
            CountlyConfig         cc      = new CountlyConfig
            {
                appKey     = section["AppKey"],
                serverUrl  = section["ServerUrl"],
                appVersion = BuildInfo.Current.InformationalVersion
            };

            Countly.Instance.Init(cc);
            Countly.Instance.SessionBegin();
            CountlyBase.IsLoggingEnabled = true;
        }
Esempio n. 14
0
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();

            XFGloss.iOS.Library.Init();
            XamEffects.iOS.Effects.Init();
            RoundedBoxViewRenderer.Init();
            ProgressRingRenderer.Init();
            Xamarin.FormsMaps.Init();
            Xamarin.FormsGoogleMaps.Init("AIzaSyDnC69vNlEd0nv9-nnI5NDFY2zj6WChPOw");
            Stormlion.PhotoBrowser.iOS.Platform.Init();

            global::Xamarin.Forms.Forms.Init();

            RegisterServiceContainers();

            //Countly initialization
            var config = new CountlyConfig()
            {
                AppKey = Config.CountlyAppKey,
                Host   = Config.CountlyServerURL,
                //EnableDebug = true,
                Features = new NSObject[] { CountlySDK.Constants.CLYCrashReporting }
            };

            Countly.SharedInstance().StartWithConfig(config);
            Countly.SharedInstance().BeginSession();

            LoadApplication(new App());

            uiApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false);

            uiApplication.SetMinimumBackgroundFetchInterval(3600);

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null
                    );

                uiApplication.RegisterUserNotificationSettings(notificationSettings);
            }

            RegisterRemoteNotifications();

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
Esempio n. 15
0
        public async void DeserializeDeviceIdString_18_1()
        {
            String targetPath = await Storage.Instance.GetFolderPath(Storage.Instance.folder) + "\\";

            String sourceFolder = TestHelper.testDataLocation + "\\SampleDataFiles\\18_1\\";

            File.Copy(sourceFolder + "devicePCL.xml", targetPath + "device.xml");
            CountlyConfig cc = TestHelper.CreateConfig();

            await Countly.Instance.Init(cc);

            String deviceId = "B249FB85668941FAA8301E2A5CA95901";

            Assert.Equal(deviceId, await Countly.GetDeviceId());
            DeviceId res = await Storage.Instance.LoadFromFile <DeviceId>(Device.deviceFilename);

            Assert.Equal(deviceId, res.deviceId);
            Assert.True((DeviceBase.DeviceIdMethodInternal)Countly.DeviceIdMethod.windowsGUID == res.deviceIdMethod);
        }
Esempio n. 16
0
        private async Task StartSessionInternal(string serverUrl, string appKey, string appVersion, DeviceIdMethod idMethod = DeviceIdMethod.cpuId)
        {
            if (ServerUrl != null)
            {
                // session already active
                return;
            }

            if (!IsInitialized())
            {
                CountlyConfig cc = new CountlyConfig()
                {
                    appKey = appKey, appVersion = appVersion, serverUrl = serverUrl, deviceIdMethod = idMethod
                };
                await Init(cc);
            }

            await SessionBeginInternal();
        }
Esempio n. 17
0
        private async Task StartSessionInternal(string serverUrl, string appKey, string appVersion, IFileSystem fileSystem)
        {
            if (ServerUrl != null)
            {
                // session already active
                return;
            }

            if (!IsInitialized())
            {
                CountlyConfig cc = new CountlyConfig()
                {
                    appKey = appKey, appVersion = appVersion, serverUrl = serverUrl, fileSystem = fileSystem
                };
                await Init(cc);
            }

            await SessionBeginInternal();
        }
Esempio n. 18
0
        private async void btnBeginSession_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("Before init");

            Countly.IsLoggingEnabled = true;

            CountlyConfig countlyConfig = new CountlyConfig();

            countlyConfig.serverUrl  = serverURL;
            countlyConfig.appKey     = appKey;
            countlyConfig.appVersion = "123";

            await Countly.Instance.Init(countlyConfig);

            Countly.UserDetails.Custom.Add("aaa", "666");

            await Countly.Instance.SessionBegin();

            Debug.WriteLine("After init");
        }
Esempio n. 19
0
        private async void App_OnStartup(object sender, StartupEventArgs e)
        {
            Debug.WriteLine("Before init");

            Countly.IsLoggingEnabled = true;

            CountlyConfig countlyConfig = new CountlyConfig();

            countlyConfig.serverUrl  = serverURL;
            countlyConfig.appKey     = appKey;
            countlyConfig.appVersion = "123";

            await Countly.Instance.Init(countlyConfig);

            await Countly.Instance.SessionBegin();

            Debug.WriteLine("After init");

            Countly.UserDetails.Name = "fdf";
        }
Esempio n. 20
0
        private async void Launched()
        {
            Debug.WriteLine("Calling [Launched]");
            //create the Countly init object
            Countly.IsLoggingEnabled = true;
            var cc = new CountlyConfig
            {
                serverUrl  = "SERVER_URL",
                appKey     = "APP_KEY",
                appVersion = "1.2.3",
            };

            //Countly.Instance.deferUpload = true;
            await Countly.Instance.Init(cc);

            await Countly.Instance.SessionBegin();

            await Countly.RecordEvent("qwedqwe");

            await Countly.Instance.RecordView("Some View");
        }
Esempio n. 21
0
        public override async Task Init(CountlyConfig config)
        {
            if (IsInitialized())
            {
                return;
            }

            if (config == null)
            {
                throw new InvalidOperationException("Configuration object can not be null while initializing Countly");
            }

            await InitBase(config);

            //after SDK has been initialized check for additional features
            if (config.application != null)
            {
                //if application reference is given, set up unhandled exception handling
                config.application.UnhandledException += unhandledExceptionHandler;
            }
        }
Esempio n. 22
0
        public async void ConsentSimpleAllowed()
        {
            Dictionary <ConsentFeatures, bool> consent = new Dictionary <ConsentFeatures, bool>();

            consent.Add(ConsentFeatures.Crashes, true);
            consent.Add(ConsentFeatures.Events, true);
            consent.Add(ConsentFeatures.Location, true);
            consent.Add(ConsentFeatures.Sessions, true);
            consent.Add(ConsentFeatures.Users, true);

            CountlyConfig cc = TestHelper.CreateConfig();

            cc.givenConsent    = consent;
            cc.consentRequired = true;
            Countly.Instance.Init(cc).Wait();
            Countly.Instance.SessionBegin().Wait();


            TestHelper.ValidateDataPointUpload().Wait();
            Countly.Instance.SessionEnd().Wait();
            TestHelper.ValidateDataPointUpload().Wait();
        }
Esempio n. 23
0
        private async Task StartSessionInternal(string serverUrl, string appKey, Application application = null, bool calledFromBackground = true)
        {
            if (ServerUrl != null)
            {
                // session already active
                return;
            }

            if (!IsInitialized())
            {
                CountlyConfig cc = new CountlyConfig()
                {
                    appKey = appKey, appVersion = DeviceData.AppVersion, serverUrl = serverUrl, application = application
                };
                await Init(cc);
            }

            if (!calledFromBackground)
            {
                await SessionBeginInternal();
            }
        }
Esempio n. 24
0
        public static void Initialize( )
        {
            if (isInitialized)
            {
                return;
            }

            if (LocalContext.GetTelemetrySettings() == false)
            {
                return;
            }
            try
            {
                DeviceId = new DeviceIdBuilder()
                           .AddMachineName()
                           .AddProcessorId()
                           .UseFormatter(new HashDeviceIdFormatter(() => SHA256.Create(), new Base64UrlByteArrayEncoder()))
                           .ToString();

                var config = new CountlyConfig()
                {
                    serverUrl                 = "https://telemetry.speckle.works",
                    appKey                    = "cd6db5058036aafb6a3a82681d434ad74ee50ad9",
                    deviceIdMethod            = Countly.DeviceIdMethod.developerSupplied,
                    developerProvidedDeviceId = DeviceId
                };

                Countly.IsLoggingEnabled = true;
                Countly.Instance.Init(config);
                Countly.Instance.RecordView("speckle-init");
                Countly.Instance.RecordView("speckle-init/version/" + typeof(SpeckleTelemetry).Assembly.GetName().Version);

                isInitialized = true;
            }catch (Exception e)
            {
                // POKEMON
                isInitialized = false;
            }
        }
        protected async Task InitBase(CountlyConfig config)
        {
            if (!IsServerURLCorrect(config.serverUrl))
            {
                throw new ArgumentException("invalid server url");
            }
            if (!IsAppKeyCorrect(config.appKey))
            {
                throw new ArgumentException("invalid application key");
            }

            ServerUrl  = config.serverUrl;
            AppKey     = config.appKey;
            AppVersion = config.appVersion;

            if (config.developerProvidedDeviceId?.Length == 0)
            {
                throw new ArgumentException("'developerProvidedDeviceId' cannot be empty string");
            }
            await DeviceData.SetPreferredDeviceIdMethod((DeviceIdMethodInternal)config.deviceIdMethod, config.developerProvidedDeviceId);

            lock (sync)
            {
                StoredRequests = Storage.Instance.LoadFromFile <Queue <StoredRequest> >(storedRequestsFilename).Result ?? new Queue <StoredRequest>();
                Events         = Storage.Instance.LoadFromFile <List <CountlyEvent> >(eventsFilename).Result ?? new List <CountlyEvent>();
                Sessions       = Storage.Instance.LoadFromFile <List <SessionEvent> >(sessionsFilename).Result ?? new List <SessionEvent>();
                Exceptions     = Storage.Instance.LoadFromFile <List <ExceptionEvent> >(exceptionsFilename).Result ?? new List <ExceptionEvent>();
            }

            //consent related
            consentRequired = config.consentRequired;
            if (config.givenConsent != null)
            {
                await SetConsent(config.givenConsent);
            }
        }
Esempio n. 26
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            app.WeakDelegate = new MyDelegate();

            //Basic Setting for countly server
            CountlyConfig config = new CountlyConfig();

            config.AppKey = "3295c8b1c8c7bccfb4cbeacf98bf8f9783ce6d4b";
            config.Host   = "https://try.count.ly";

            //Assign additional feature to countly config object
            config.Features = new NSObject[] { Constants.CLYPushNotifications, Constants.CLYCrashReporting, Constants.CLYAutoViewTracking };


            //Manually set your deviceID to countly server
            var udid = UIKit.UIDevice.CurrentDevice.IdentifierForVendor.AsString();

            config.DeviceID = udid;
            Countly.SharedInstance().SetNewDeviceID(udid, true);
            config.AlwaysUsePOST = true;


            // You can automatically ask users for star rating
            config.StarRatingMessage      = @"Would you rate the app?";
            config.StarRatingSessionCount = 10;
            config.StarRatingDisableAskingForEachAppVersion = true;



            config.CustomHeaderFieldName  = @"My-Custom-Field";
            config.CustomHeaderFieldValue = @"20";


            //Add your country code and location
            config.ISOCountryCode = @"IN";
            config.City           = @"Noida";
            config.Location       = new CLLocationCoordinate2D(28.5986, 77.3339);



            Countly.SharedInstance().StartWithConfig(config);
            Countly.SharedInstance().AskForStarRating((obj) => Console.Write("Rating"));

            // You can record various events with different scenarios
            Countly.SharedInstance().RecordEvent("Xamarin studio", 12);
            var dict = new NSDictionary("Country", "India", "App_Version", 1.0);

            Countly.SharedInstance().RecordEvent("Xamarin_ios", dict, 12, 20, .5);

            //Tracking timed event
            Countly.SharedInstance().StartEvent("Tracking AppRating");
            Countly.SharedInstance().EndEvent("Tracking AppRating");


            // Manually set user profiles
            Countly.User.Name         = "Xamarians";
            Countly.User.Username     = "******";
            Countly.User.Email        = "*****@*****.**";
            Countly.User.BirthYear    = "1970";
            Countly.User.Organization = "United Nations";
            Countly.User.Gender       = "M";
            Countly.User.Phone        = "+0123456789";
            Countly.User.RecordUserDetails();

            //In addition, you can use custom user details modifiers
            Countly.User.Set(@"key101", @"value101");
            Countly.User.IncrementBy(@"key102", 5);
            Countly.User.Multiply(@"key102", 2);
            Countly.User.Max(@"key102", 30);
            Countly.User.Min(@"key102", 20);
            Countly.User.Push(@"key103", "a");
            Countly.User.PushUnique(@"key104", @"uniqueValue");
            Countly.User.Save();


            //Auto view tracking
            Countly.SharedInstance().AddExceptionForAutoViewTracking(@"MyViewControllerTitle");
            Countly.SharedInstance().IsAutoViewTrackingEnabled = true;
            Countly.SharedInstance().ReportView("my View");


            //Push Notification
            Countly.SharedInstance().AskForNotificationPermission();
            Countly.SharedInstance().RecordLocation(new CLLocationCoordinate2D(28.5986, 77.3339));

            return(base.FinishedLaunching(app, options));
        }
Esempio n. 27
0
        public async Task Run()
        {
            Console.WriteLine("Hello to the Countly sample console program");

            if (serverURL == null || appKey == null)
            {
                Console.WriteLine("");
                Console.WriteLine("Problem encountered, you have not set up either the serverURL or the appKey");
                Console.ReadKey();
                return;
            }

            Countly.IsLoggingEnabled = true;
            //Countly.SetCustomDataPath(@"D:\123z\");//usable only when targeting .net3.5
            //Countly.SetCustomDataPath(null);

            CountlyConfig countlyConfig = new CountlyConfig();

            countlyConfig.serverUrl  = serverURL;
            countlyConfig.appKey     = appKey;
            countlyConfig.appVersion = "123";

            await Countly.Instance.Init(countlyConfig);

            await Countly.Instance.SessionBegin();

            /*
             * //Countly.deferUpload = true;//this call is only available by allowing access to internal members to this project, should not be used
             * await Countly.StartSession(serverURL, appKey, "1.234", Countly.DeviceIdMethod.multipleFields);
             */
            Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            System.Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            while (true)
            {
                Console.WriteLine("");
                Console.WriteLine("Choose your option:");
                Console.WriteLine("1) Sample event");
                Console.WriteLine("2) Sample caught exception");
                Console.WriteLine("3) Change deviceID to a random value (create new user)");
                Console.WriteLine("4) Change the name of the current user");
                Console.WriteLine("5) Exit");
                Console.WriteLine("6) Another caught Exception");
                Console.WriteLine("7) Some view");
                Console.WriteLine("8) Another view");
                Console.WriteLine("9) Test");

                if (enableDebugOpptions)
                {
                    Console.WriteLine("8) (debug) Threading test");
                }


                ConsoleKeyInfo cki = System.Console.ReadKey();
                Console.WriteLine("");

                if (cki.Key == ConsoleKey.D1)
                {
                    System.Console.WriteLine("1");
                    Countly.RecordEvent("Some event");
                }
                else if (cki.Key == ConsoleKey.D2)
                {
                    Console.WriteLine("2");

                    try
                    {
                        throw new Exception("This is some bad exception 3");
                    }
                    catch (Exception ex)
                    {
                        Dictionary <string, string> customInfo = new Dictionary <string, string>();
                        customInfo.Add("customData", "importantStuff");
                        Countly.RecordException(ex.Message, ex.StackTrace, customInfo);
                    }
                }
                else if (cki.Key == ConsoleKey.D3)
                {
                    Console.WriteLine("3");
                    //await Device.SetDeviceId("ID-" + (new Random()).Next());
                }
                else if (cki.Key == ConsoleKey.D4)
                {
                    Console.WriteLine("4");
                    Countly.UserDetails.Name = "Some Username " + (new Random()).Next();
                }
                else if (cki.Key == ConsoleKey.D5)
                {
                    Console.WriteLine("5");
                    break;
                }
                else if (cki.Key == ConsoleKey.D6)
                {
                    Console.WriteLine("6");
                    await Countly.RecordException("What is here", "");
                }
                else if (cki.Key == ConsoleKey.D7)
                {
                    Console.WriteLine("7");
                    await Countly.Instance.RecordView("Some view Name");
                }
                else if (cki.Key == ConsoleKey.D8)
                {
                    Console.WriteLine("8");
                    await Countly.Instance.RecordView("Another view Name");
                }
                else if (enableDebugOpptions && cki.Key == ConsoleKey.D9)
                {
                    Console.WriteLine("8");
                    Console.WriteLine("Running threaded debug test");
                    ThreadTest();
                }
                else
                {
                    Console.WriteLine("Wrong input, please try again.");
                }
            }
            ;

            await Countly.EndSession();
        }
 public abstract Task Init(CountlyConfig config);