public void SendErrorEvent(string errorMessage, string method) { Dictionary <String, String> segmentation = new Dictionary <String, String>(); segmentation.Add("error", errorMessage); segmentation.Add("method", method); Countly.SharedInstance().RecordEvent("Show_Generic_Error", segmentation, 1); }
protected override void OnStop() { MainActivity.IsActive = false; Countly.SharedInstance().OnStop(); PackageService.IsNeedRequestPackages = true; EventService.IsNeedSendEvents = false; base.OnStop(); }
protected override void OnStart() { base.OnStart(); Countly.SharedInstance().OnStart(this); Countly.SharedInstance().RecordEvent("purchase", 1, 0.99); try { Countly.SharedInstance().ShowStarRating(this, null); } catch (Exception ex) { } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var c = Countly.SharedInstance().Init(this, "https://try.count.ly", "8651b1be8415966a91b57c5e0193d1dc2bbb7ee9"); c.InitMessaging(this, this.Class, "PROJECT_NUMBER", Countly.CountlyMessagingMode.Test); var usedId = Countly.SharedInstance().DeviceID; var idType = Countly.SharedInstance().DeviceIDType; // Countly.SharedInstance().SetOptionalParametersForInitialization("2 character country code", "city", "56.42345,123.45325"); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); }
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)); }
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)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); jobScheduler = (JobScheduler)GetSystemService(JobSchedulerService); XamEffects.Droid.Effects.Init(); XFGloss.Droid.Library.Init(this, bundle); ZXing.Net.Mobile.Forms.Android.Platform.Init(); Xamarin.FormsMaps.Init(this, bundle); Xamarin.FormsGoogleMaps.Init(this, bundle, null); Stormlion.PhotoBrowser.Droid.Platform.Init(this); Vapolia.Droid.Lib.Effects.PlatformGestureEffect.Init(); Countly.SharedInstance().Init(this, Config.CountlyServerURL, Config.CountlyAppKey).EnableCrashReporting(); //Countly.SharedInstance().SetLoggingEnabled(true); Instance = this; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; RegisterServiceContainers(); global::Xamarin.Forms.Forms.Init(this, bundle); RoundedBoxViewRenderer.Init(); LoadApplication(new App()); UserDialogs.Init(this); CrossCurrentActivity.Current.Init(this, bundle); CrossCurrentActivity.Current.Activity = this; InitializeUIAsync(); if (Intent != null && Intent.DataString != null) { try { string package = ""; package = Intent.Data.GetQueryParameter("id"); if (package != null && package != "") { Xamarin.Forms.MessagingCenter.Send <string, string>(Constants.NOTIFICATION, Constants.APP_LAUNCHED_FROM_DEEP_LINK, package); } } catch (Exception e) { Console.WriteLine(e); } } //StartPackageService(); IsPlayServicesAvailable(); CreateNotificationChannel(); var refreshedToken = FirebaseInstanceId.Instance.Token; if (refreshedToken != null) { App.Locator.DeviceService.FCMToken = refreshedToken; SendRegistrationToServer(refreshedToken); } }
public void SendErrorEvent(string errorMessage, string method) { var dict = new NSDictionary("error", errorMessage, "method", method); Countly.SharedInstance().RecordEvent("Show_Generic_Error", dict); }
protected override void OnStop() { base.OnStop(); Countly.SharedInstance().OnStop(); }