예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine($"Mixpanel version: {Mixpanel.LibVersionStatic}");
            var mixpanel = Mixpanel.SharedInstanceWithToken("YOUR_TOKEN");

            // Adding this will allow us to see Mixpanel is trying to function even though it has an invalid token.
            mixpanel.EnableLogging = true;
            mixpanel.Track("This Event Happened");

            // This exists for Android but there does not seem to be a similar method call for iOS.

            /*
             * stringBuilder.AppendLine("Device info:");
             * foreach (var deviceInfo in mixpanel.DeviceInfo)
             * {
             *  stringBuilder.AppendLine($" - {deviceInfo.Key}: {deviceInfo.Value}");
             * }
             */


            MainTextView.Text = stringBuilder.ToString();
        }
예제 #2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            MixpanelTweaks.Register(typeof(AppTweaks));
            Mixpanel.SharedInstanceWithToken("<YOUR TOKEN>");
            Mixpanel.SharedInstance.Track("Launch");

            return(true);
        }
예제 #3
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Use your own token.
            Mixpanel.SharedInstanceWithToken(MixpanelToken);

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            viewController            = new MixpanelTestViewController();
            window.RootViewController = viewController;
            window.MakeKeyAndVisible();

            return(true);
        }
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            NSUserDefaults.StandardUserDefaults.RegisterDefaults(NSDictionary.FromObjectAndKey(new NSString(_mixpanelTokenKey), new NSString(MIXPANEL_TOKEN)));

            var mixpanelToken = NSUserDefaults.StandardUserDefaults.StringForKey(_mixpanelTokenKey);

            Window.MakeKeyAndVisible();

            if (string.IsNullOrEmpty(mixpanelToken) || mixpanelToken.Equals("YOUR_MIXPANEL_PROJECT_TOKEN", StringComparison.OrdinalIgnoreCase))
            {
#if DEBUG
                var alert = UIAlertController.Create("Mixpanel Token Required", "Go to Settings > Mixpanel and add your project's token", UIAlertControllerStyle.Alert);

                alert.AddAction(UIAlertAction.Create("Okay", UIAlertActionStyle.Default, (obj) => UIApplication.SharedApplication.OpenUrl(NSUrl.FromString(UIApplication.OpenSettingsUrlString))));

                Window.RootViewController.PresentViewController(alert, true, null);

                return(true);
#endif
            }
            else
            {
                // Initialize the MixpanelAPI object
                mixpanel = Mixpanel.SharedInstanceWithToken(mixpanelToken, launchOptions);
                Console.WriteLine(mixpanel);
            }


            mixpanel.CheckForSurveysOnActive = true;
            mixpanel.ShowSurveyOnActive      = true;        // Change this to false to show your surveys manually.

            mixpanel.CheckForNotificationsOnActive = true;
            mixpanel.ShowNotificationOnActive      = true;        //Change this to false to show your notifs manually.

            // Set the upload interval to 20 seconds for demonstration purposes. This would be overkill for most applications.
            mixpanel.FlushInterval = 20;             // defaults to 60 seconds

            // Set some super properties, which will be added to every tracked event
            mixpanel.RegisterSuperProperties(NSDictionary.FromObjectAndKey(new NSString("Plan"), new NSString("Premium")));

            // Name a user in Mixpanel Streams
            mixpanel.NameTag = "Walter Sobchak";


            var userNotificationSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, null);

            UIApplication.SharedApplication.RegisterUserNotificationSettings(userNotificationSettings);

            return(true);
        }
예제 #5
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method
            Xamarin.IQKeyboardManager.SharedManager.ShouldResignOnTouchOutside = true;
            Xamarin.IQKeyboardManager.SharedManager.EnableAutoToolbar          = true;
            ImageService.Instance.Config.SchedulerMaxParallelTasks             = 6;

            var manager = BITHockeyManager.SharedHockeyManager;

            manager.Configure("8a31b849e71547c7b6137a87d58fdb09");
            manager.StartManager();
            Settings.AppID       = ConstantsHelper.FB_ApplicationID; //"469763806538563";
            Settings.DisplayName = ConstantsHelper.AppName;          //"Fanword";

            MixpanelTweaks.Register(typeof(AppTweaks));
            Mixpanel.SharedInstanceWithToken(MIXPANEL_TOKEN);
            Mixpanel.SharedInstance.Track("Launch");


            CrossPushNotifications.Current.Configure(ServiceApiBase.HubName, ServiceApiBase.AzureConnectionString, new[] { "fanword" }, 0);
            CrossPushNotifications.Current.PushNotificationClicked += (sender, e) =>
            {
                if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Inactive && MainViewController.Instance?.NavigationController != null)
                {
                    // clicked on notification from background
                    var notification = (e as PushNotificationItem);
                    Navigator.HandleNotificationTap(MainViewController.Instance.NavigationController, notification.MetaData, notification.Title, notification.Message);
                }
                else if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Active)
                {
                    // Update badge
                    MainViewController.Instance?.GetNotifications();
                }
                else
                {
                    // app closed
                    ClickedNotification = (e as PushNotificationItem);
                }
            };

            return(true);
        }