예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.Second);

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSecondEvent = FindViewById <Button> (Resource.Id.btnSecondEvent);


            btnSecondEvent.Click += delegate {
                // May return null if a EasyTracker has not yet been initialized with a
                // property ID.
                var easyTracker = EasyTracker.GetInstance(this);

                // MapBuilder.createEvent().build() returns a Map of event fields and values
                // that are set and sent with the hit.
                var gaEvent = MapBuilder.CreateEvent("UI", "button_press", "create_and_send_2nd_button", null).Build();
                easyTracker.Send(gaEvent);

                Console.WriteLine("Event Sent, please see GA Events Console");
            };
        }
예제 #2
0
        protected override void OnStop()
        {
            base.OnStop();

            // Stop Google Analytics Easy Tracker
            EasyTracker.GetInstance(this).ActivityStop(this);
        }
예제 #3
0
        protected override void OnStart()
        {
            base.OnStart();

            // Setup Google Analytics Easy Tracker
            EasyTracker.GetInstance(this).ActivityStart(this);

            // By default, data is dispatched from the Google Analytics SDK for Android every 30 minutes.
            // You can override this by setting the dispatch period in seconds.
            GAServiceManager.Instance.SetLocalDispatchPeriod(5);
        }
예제 #4
0
        protected override void OnStop()
        {
            base.OnStop();
            if (accelerometerManager.IsListening)
            {
                accelerometerManager.StopListening();
            }

            imageViewAnimated.Stop();
            EasyTracker.GetInstance(this).ActivityStop(this);
            GAServiceManager.Instance.SetLocalDispatchPeriod(60);
        }
예제 #5
0
        protected override void OnStop()
        {
            base.OnStop();

            // Manual View Tracking

            // May return null if EasyTracker has not yet been initialized with a property Id.
            var easyTracker = EasyTracker.GetInstance(this);

            // This screen name value will remain set on the tracker and sent with
            // hits until it is set to a new value or to null.
            easyTracker.Set(Fields.ScreenName, null);
        }
예제 #6
0
        private async Task LoadImage(OverflowHelper.Animal animal)
        {
            progressBar.Visibility       = ViewStates.Visible;
            progressBar.Indeterminate    = true;
            imageView.Visibility         = ViewStates.Gone;
            imageViewAnimated.Visibility = ViewStates.Gone;
            buttonKitty.Enabled          = false;
            buttonPuppy.Enabled          = false;

            state.SetDefault = true;
            state.Image      = animal == OverflowHelper.Animal.Cat ? "cat" : "dog";
            var eventType = string.Empty;

            switch (animal)
            {
            case OverflowHelper.Animal.Cat:
                eventType = "cat";
                break;

            case OverflowHelper.Animal.Dog:
                eventType = "dog";
                break;

            case OverflowHelper.Animal.Otter:
                eventType = "otter";
                break;
            }
            EasyTracker.GetInstance(this).Send(MapBuilder.CreateEvent("ui_action", "load_animal", eventType, null).Build());
            try
            {
                var image =
                    await OverflowHelper.GetPictureAsync(animal);

                if (!string.IsNullOrWhiteSpace(image))
                {
                    state.SetDefault = false;
                    state.Image      = image;
                }
            }
            catch (Exception)
            {
            }

            await SetImage();

            progressBar.Visibility    = ViewStates.Invisible;
            progressBar.Indeterminate = false;
            buttonKitty.Enabled       = true;
            buttonPuppy.Enabled       = true;
            //AndHUD.Shared.Dismiss(this);
        }
예제 #7
0
        protected override void OnStart()
        {
            base.OnStart();

            // Manual View Tracking

            // May return null if EasyTracker has not yet been initialized with a property Id.
            var easyTracker = EasyTracker.GetInstance(this);

            // This screen name value will remain set on the tracker and sent with
            // hits until it is set to a new value or to null.
            easyTracker.Set(Fields.ScreenName, "2nd Activity");
            var gaSecondEvent = MapBuilder.CreateAppView().Build();

            easyTracker.Send(gaSecondEvent);
        }
예제 #8
0
        private void RegisterComponents()
        {
            // Register common Phoebe components:
            ServiceContainer.Register <MessageBus> ();
            ServiceContainer.Register <ModelManager> ();
            ServiceContainer.Register <AuthManager> ();
            ServiceContainer.Register <SyncManager> ();
            ServiceContainer.Register <ITogglClient> (() => new TogglRestClient(Build.ApiUrl));
            ServiceContainer.Register <IPushClient> (() => new PushRestClient(Build.ApiUrl));
            ServiceContainer.Register <ITimeProvider> (() => new DefaultTimeProvider());

            // Register Joey components:
            ServiceContainer.Register <Logger> (() => new AndroidLogger());
            ServiceContainer.Register <Context> (this);
            ServiceContainer.Register <IPlatformInfo> (this);
            ServiceContainer.Register <SettingsStore> (() => new SettingsStore(Context));
            ServiceContainer.Register <ISettingsStore> (() => ServiceContainer.Resolve <SettingsStore> ());
            ServiceContainer.Register <IModelStore> (delegate {
                string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                var path      = System.IO.Path.Combine(folder, "toggl.db");
                return(new SQLiteModelStore(path));
            });
            ServiceContainer.Register <SyncMonitor> ();
            ServiceContainer.Register <GcmRegistrationManager> ();
            ServiceContainer.Register <AndroidNotificationManager> ();
            ServiceContainer.Register <BugsnagClient> (delegate {
                return(new Toggl.Joey.Bugsnag.BugsnagClient(this, Build.BugsnagApiKey)
                {
                    DeviceId = ServiceContainer.Resolve <SettingsStore> ().InstallId,
                    ProjectNamespaces = new List <string> ()
                    {
                        "Toggl."
                    },
                });
            });
            ServiceContainer.Register <BugsnagUserManager> ();
            ServiceContainer.Register <EasyTracker> (delegate {
                #if DEBUG
                GoogleAnalytics.GetInstance(this).SetDryRun(true);
                #endif

                var tracker = EasyTracker.GetInstance(this);
                tracker.Set(Fields.TrackingId, Build.GoogleAnalyticsId);
                return(tracker);
            });
        }
예제 #9
0
        protected override void OnStop()
        {
            base.OnStop();
#if !DEBUG
            // May return null if EasyTracker has not yet been initialized with a property Id.
            var easyTracker = EasyTracker.GetInstance(this);
            if (easyTracker == null)
            {
                return;
            }

            // This screen name value will remain set on the tracker and sent with
            // hits until it is set to a new value or to null.
            easyTracker.Set(Fields.ScreenName, null);
            easyTracker.ActivityStop(this);
#endif
        }
예제 #10
0
        protected void LogEvent(string category, string action, string label)
        {
#if !DEBUG
            var tracker = EasyTracker.GetInstance(this);
            if (tracker == null)
            {
                return;
            }

            tracker.Send(MapBuilder
                         .CreateEvent(category, // Event category (required)
                                      action,   // Event action (required)
                                      label,    // Event label
                                      null)     // Event value
                         .Build());
#endif
        }
예제 #11
0
        protected override void OnStart()
        {
            base.OnStart();

#if !DEBUG
            // Setup Google Analytics Easy Tracker
            var tracker = EasyTracker.GetInstance(this);
            if (tracker == null)
            {
                return;
            }

            tracker.ActivityStart(this);
            tracker.Set(Fields.ScreenName, Tag);
            // By default, data is dispatched from the Google Analytics SDK for Android every 30 minutes.
            // You can override this by setting the dispatch period in seconds.
            GAServiceManager.Instance.SetLocalDispatchPeriod(20);
#endif
        }
예제 #12
0
 protected override void OnStart()
 {
     base.OnStart();
     EasyTracker.GetInstance(this).ActivityStart(this);
 }