public override void OnActivityCreated(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(Context); base.OnCreate(savedInstanceState); var sessions = Queries.AllNotUploadedInterviewSessionsForActiveUser(); sessions = sessions.FindAll(t => !t.IsUploaded); adapter = new SessionAdapter(sessions); Activity.FindViewById <RecyclerView>(Resource.Id.sessions).SetAdapter(adapter); var sessionsUploadButton = Activity.FindViewById <AppCompatButton>(Resource.Id.upload_sessions); ShowHideInstructions(); sessionsUploadButton.Click += (s, e) => UploadIfNot(0, true); adapter.SessionClicked += (s, p) => UploadIfNot(p, false); var prefs = PreferenceManager.GetDefaultSharedPreferences(Activity.ApplicationContext); // Ensures that the dialog only shows after completing a recording. if (prefs.GetBoolean("SESSION_RECORDED", false)) { prefs.Edit().PutBoolean("SESSION_RECORDED", false).Commit(); ShowDebriefingDialog(); } }
protected override void OnCreate(Bundle bundle) { base.Window.RequestFeature(WindowFeatures.ActionBar); //Init CachedImageRenderer CachedImageRenderer.Init(); FFImageLoading.Config.Configuration ffConfig = new FFImageLoading.Config.Configuration { BitmapOptimizations = true, SchedulerMaxParallelTasks = 4, VerboseLogging = false, VerbosePerformanceLogging = false, VerboseMemoryCacheLogging = false, VerboseLoadingCancelledLogging = false, HttpClient = new System.Net.Http.HttpClient(new Xamarin.Android.Net.AndroidClientHandler()) }; FFImageLoading.ImageService.Instance.Initialize(ffConfig); //Start service on app launch TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; this.SetTheme(Resource.Style.MyTheme); base.SetTheme(Resource.Style.MyTheme); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); firebaseAnalytics = FirebaseAnalytics.GetInstance(this); LoadApplication(new App()); }
public override void OnActivityCreated(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(Context); base.OnCreate(savedInstanceState); _projects = Queries.AllProjects(); // It is not possible to SetAdapter in OnActivityCreated as accessing the rootView. adapter = new ProjectsAdapter(_projects); adapter.ProjectClicked += OnProjectClick; Activity.FindViewById <RecyclerView>(Resource.Id.projects).SetAdapter(adapter); // As this method is called each time the Fragment is in view (similar to onResume), // only call it if there are no projects, i.e. on first use. if (_projects.Count <= 0) { LoadDataIfNotLoading(true); } var refresher = Activity.FindViewById <SwipeRefreshLayout>(Resource.Id.projectsRefresher); refresher.SetColorSchemeResources(Resource.Color.primary_material_dark); refresher.Refresh += async delegate { LOG_SWIPE_REFRESH(); await LoadData(); refresher.Refreshing = false; }; }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; UserDialogs.Init(this); FirebaseApp.InitializeApp(this); firebaseAnalytics = FirebaseAnalytics.GetInstance(this); var playAvailable = IsPlayServicesAvailable(); if (playAvailable) { new GetRemoteConfig(); Intent locIntent = new Intent(this, typeof(SaleLocationService)); StartService(locIntent); fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this); FusedLocationProviderCallback callback = new FusedLocationProviderCallback(this); fusedLocationProviderClient.RequestLocationUpdatesAsync(callback.LocationRequest, callback); } base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); global::Xamarin.FormsMaps.Init(this, bundle); LoadApplication(new App()); #if DEBUG MocksLocation(); #endif }
protected override void OnCreate(Bundle bundle) { // Xamarin.Forms.Platform.Android. TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; // toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); // var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); // SetSupportActionBar(toolbar); // SetActionBar(toolbar); // ActionBar.Title = "My Title"; // toolbar.SetTitle(Resource.String.app_name); // this.ActionBar.Title = "My Toolbar"; FirebaseApp.InitializeApp(this); firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); // var x = typeof(Xamarin.Forms.Themes.DarkThemeResources); // var x = typeof(Xamarin.Forms.Themes.LightThemeResources); // x = typeof(Xamarin.Forms.Themes.Android.UnderlineEffect); }
private void EnsureSessionIsValid() { if (Session.PrivatePath == null) { Session.PrivatePath = new PrivatePath(); } if (RestClient.GlobalIO == null) { RestClient.GlobalIO = new DiskIO(); } if (!Fabric.Fabric.IsInitialized) { Fabric.Fabric.With(this, new Crashlytics.Crashlytics()); Crashlytics.Crashlytics.HandleManagedExceptions(); } if (MainActivity.FireBaseAnalytics == null) { FirebaseApp.InitializeApp(ApplicationContext); MainActivity.FireBaseAnalytics = FirebaseAnalytics.GetInstance(this); } PlayServicesAvailable = IsPlayServicesAvailable(); if (notificationManager == null) { CreateNotificationChannel(); } }
public void SetScreenAndClassName(string screenName, string screenClassName) { var context = CrossCurrentActivity.Current as Activity; var fireBaseAnalytics = FirebaseAnalytics.GetInstance(context); fireBaseAnalytics.SetCurrentScreen(context, screenName, screenClassName); }
internal static void LogUnhandledException(Exception exception) { try { const string errorFileName = "Fatal.log"; var libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var errorFilePath = Path.Combine(libraryPath, errorFileName); var errorMessage = String.Format("Time: {0}\r\nError: Unhandled Exception\r\n{1}", DateTime.Now, exception.ToString()); File.WriteAllText(errorFilePath, errorMessage); // Log to Android Device Logging. Android.Util.Log.Error("Crash Report", errorMessage); var firebaseAnalytics = FirebaseAnalytics.GetInstance(Application.Context); var bundle = new Bundle(); bundle.PutString("Exception", exception.Message); bundle.PutString("Stack", exception.StackTrace); firebaseAnalytics.LogEvent("AppCrash", bundle); new AlertDialog.Builder(Application.Context) .SetNeutralButton("Close", (sender, args) => { // User pressed Close. }) .SetMessage("Oops, something has gone wrong, the error has been logged. Please reopen the app and try again.") .SetTitle("Crashed") .Show(); } catch { // just suppress any error logging exceptions } }
protected override void OnResume() { base.OnResume(); var firebaseAnalytics = FirebaseAnalytics.GetInstance(this); Init.Initialize(new CustomInit()); LocalProvider = Methods.GetService <ILocalProvider>(); //Task.Factory.StartNew(async () => { // await Task.Delay(2000); var user = LocalProvider.GetCurrentUser(); if (user != null) { StartActivity(new Intent(this, typeof(UserProfile))); Finish(); } else { StartActivity(new Intent(this, typeof(Login))); Finish(); } //var auth = FirebaseAuth.Instance; //}); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); // Initialize firebase instance firebaseAnalytics = FirebaseAnalytics.GetInstance(this); // 不明点 // Debugビルドだと以下のようにDeleteInstanceId()を呼んでInstanceIdをリフレッシュしないと再起動後通知が受け取れない // Releaseビルドだと以下の作業は不要でSubscribeするだけでそのトピックへの通知を受け取ることができる #if DEBUG Task.Run(() => { var instanceID = FirebaseInstanceId.Instance; instanceID.DeleteInstanceId(); var iid1 = instanceID.Token; var iid2 = instanceID.GetToken(GetString(Resource.String.gcm_defaultSenderId), Firebase.Messaging.FirebaseMessaging.InstanceIdScope); FirebaseMessaging.Instance.SubscribeToTopic("all"); }); #else FirebaseMessaging.Instance.SubscribeToTopic("all"); #endif // [END get_token] LoadApplication(new App()); }
public void SetUserId(string userId) { #if !DEBUG var fireBaseAnalytics = FirebaseAnalytics.GetInstance(CrossCurrentActivity.Current.AppContext); fireBaseAnalytics.SetUserId(userId); #endif }
public void SetUserId(string userId) { //#if !DEBUG var fireBaseAnalytics = FirebaseAnalytics.GetInstance(Android.App.Application.Context); fireBaseAnalytics.SetUserId(userId); //#endif }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByCulture(this); SetContentView(Resource.Layout.onboarding); pager = FindViewById <ViewPager>(Resource.Id.pager); var pages = new List <OnboardingPageContent> { new OnboardingPageContent { Image = Resource.Drawable.AppLogo, Title = StringResources.onboarding_ui_page_zero_title, Content = StringResources.onboarding_ui_page_zero_content }, new OnboardingPageContent { Image = Resource.Drawable.onboarding_02, Title = StringResources.onboarding_ui_page_first_title, Content = StringResources.onboarding_ui_page_first_content }, new OnboardingPageContent { Image = Resource.Drawable.onboarding_03, Title = StringResources.onboarding_ui_page_second_title, Content = StringResources.onboarding_ui_page_second_content }, new OnboardingPageContent { Image = Resource.Drawable.onboarding_04, Title = StringResources.onboarding_ui_page_third_title, Content = StringResources.onboarding_ui_page_third_content }, new OnboardingPageContent { Image = Resource.Drawable.onboarding_05, Title = StringResources.onboarding_ui_page_fourth_title, Content = string.Format(StringResources.onboarding_ui_page_fourth_content, GabberPCL.Config.PRINT_URL) } }; pager.Adapter = new Adapters.SharedPager(this, pages); pager.AddOnPageChangeListener(this); var tabs = FindViewById <TabLayout>(Resource.Id.tabs); tabs.SetupWithViewPager(pager, true); tabs.SetSelectedTabIndicatorHeight(0); var login = FindViewById <AppCompatButton>(Resource.Id.login); login.Text = StringResources.login_ui_submit_button; login.Click += (sender, e) => StartActivity(typeof(LoginActivity)); var register = FindViewById <AppCompatButton>(Resource.Id.register); register.Text = StringResources.register_ui_submit_button; register.Click += (sender, e) => StartActivity(typeof(RegisterActivity)); }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByCulture(this); SetContentView(Resource.Layout.register); SupportActionBar.Title = StringResources.register_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); FindViewById <TextView>(Resource.Id.loadingMessage).Text = StringResources.common_comms_loading; languageSpinner = FindViewById <Spinner>(Resource.Id.chooseLanguageSpinner); languageSpinner.ItemSelected += LanguageSpinner_ItemSelected; AppCompatButton submit = FindViewById <AppCompatButton>(Resource.Id.submit); submit.Text = StringResources.register_ui_submit_button; TextInputLayout nameInput = FindViewById <TextInputLayout>(Resource.Id.nameLayout); nameInput.Hint = StringResources.register_ui_fullname_label; TextInputLayout emailInput = FindViewById <TextInputLayout>(Resource.Id.emailLayout); emailInput.Hint = StringResources.common_ui_forms_email_label; TextInputLayout passwordInput = FindViewById <TextInputLayout>(Resource.Id.passwordLayout); passwordInput.Hint = StringResources.common_ui_forms_password_label; TextInputLayout confirmPassInput = FindViewById <TextInputLayout>(Resource.Id.passwordConfirmLayout); confirmPassInput.Hint = StringResources.common_ui_forms_password_confirm_label; var terms = FindViewById <TextView>(Resource.Id.Terms); var termsContent = string.Format(StringResources.register_ui_terms_label, Config.WEB_URL); terms.TextFormatted = Android.Text.Html.FromHtml(termsContent); terms.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; FindViewById <TextInputEditText>(Resource.Id.password).EditorAction += (_, e) => { e.Handled = false; if (e.ActionId == Android.Views.InputMethods.ImeAction.Done) { FindViewById <AppCompatButton>(Resource.Id.submit).PerformClick(); e.Handled = true; } }; submit.Click += Submit_Click; LoadLanguages(); }
public override void OnActivityCreated(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(Context); base.OnCreate(savedInstanceState); var sessions = Queries.AllNotUploadedInterviewSessionsForActiveUser(); sessions = sessions.FindAll(t => !t.IsUploaded); adapter = new SessionAdapter(sessions); Activity.FindViewById <RecyclerView>(Resource.Id.sessions).SetAdapter(adapter); FirebaseAnalytics.GetInstance(Activity).SetUserProperty( "uploadQueueCount", sessions.Count().ToString()); var sessionsUploadButton = Activity.FindViewById <AppCompatButton>(Resource.Id.upload_sessions); ShowHideInstructions(); sessionsUploadButton.Click += (s, e) => UploadIfNot(0, true); adapter.SessionClicked += (s, p) => UploadIfNot(p, false); var prefs = PreferenceManager.GetDefaultSharedPreferences(Activity.ApplicationContext); // Ensures that the dialog only shows after completing a recording. if (prefs.GetBoolean("SESSION_RECORDED", false)) { // Get epoch time TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1); int secondsSinceEpoch = (int)t.TotalSeconds; FirebaseAnalytics.GetInstance(Activity).SetUserProperty( "lastUploadAdded", secondsSinceEpoch.ToString()); if (IsConnectedToWifi()) { var suppressAsync = UploadSessions(0, true); } else { new AlertDialog.Builder(Activity) .SetTitle(StringResources.sessions_ui_wifiwarning_title) .SetMessage(StringResources.sessions_ui_wifiwarning_message) .SetNegativeButton(StringResources.sessions_ui_wifiwarning_cancel, (a, b) => { }) .SetPositiveButton(StringResources.sessions_ui_wifiwarning_confirm, (a, b) => { var suppressAsync = UploadSessions(0, true); }) .Show(); } prefs.Edit().PutBoolean("SESSION_RECORDED", false).Commit(); } }
public void TrackScreen(string screenName) { Bundle bundle = new Bundle(); bundle.PutString(FirebaseAnalytics.Param.ScreenName, screenName); bundle.PutString(FirebaseAnalytics.Param.ScreenClass, Xamarin.Essentials.Platform.CurrentActivity.Title); var fireBaseAnalytics = FirebaseAnalytics.GetInstance(Xamarin.Essentials.Platform.CurrentActivity); fireBaseAnalytics?.LogEvent(FirebaseAnalytics.Event.ScreenView, bundle); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
/// <summary> /// Setup Firebase Analytics /// </summary> private void SetupFirebaseAnalytics() { var googleAppId = GetString(Resource.String.google_app_id); if (string.IsNullOrEmpty(googleAppId)) { var errorMessage = "Invalid google-services.json file. Make sure you've downloaded your own config file and added it to your app project with the 'GoogleServicesJson' build action."; Console.WriteLine(errorMessage); return; } FirebaseAnalyticsInstance = FirebaseAnalytics.GetInstance(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); FindViewById <ImageButton>(Resource.Id.login_button).Click += LoginToApp; // Create your application here AppCenter.Start("4b376e42-98b2-47fd-af73-7a84453954f9"); FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.GetInstance(this); FirebaseOptions options = new FirebaseOptions.Builder() .SetApiKey("AIzaSyBnw6unIyRQ4XfFZNekTpU7rWumSvv5cnw") .SetApplicationId("1:316655980255:android:05c55f9b9a1c0243") .Build(); if (Intent != null) { if (FirebaseDynamicLinks.Instance != null) { try { Task dynamicTask = FirebaseDynamicLinks.Instance.GetDynamicLink(Intent); dynamicTask?.AddOnSuccessListener(this); } catch (System.Exception e) { Crashlytics.Crashlytics.LogException(Throwable.FromException(e)); } } FirebaseApp firebaseApp = FirebaseApp.Instance ?? FirebaseApp.InitializeApp(ApplicationContext, options); Intent intent = Intent; string dataString = intent?.DataString; Android.Net.Uri data = intent?.Data; if (dataString != null && data != null) { Bundle bundle = new Bundle(); bundle.PutString(FirebaseAnalytics.Param.ItemId, data.Scheme); bundle.PutString(FirebaseAnalytics.Param.ItemName, data.Host); bundle.PutString(FirebaseAnalytics.Param.ContentType, "text"); mFirebaseAnalytics.LogEvent(FirebaseAnalytics.Event.GenerateLead, bundle); if (dataString.Contains("https://cycles.page.link/tc4X")) { } } } FindViewById <Button>(Resource.Id.goto_signup).Click += GotoSignUp; }
protected override void OnCreate(Bundle savedInstanceState) { FirebaseApp.InitializeApp(ApplicationContext); firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); // Used by the PCL for database interactions so must be defined early. Session.PrivatePath = new PrivatePath(); // Register the implementation to the global interface within the PCL. RestClient.GlobalIO = new DiskIO(); var preferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); var UserEmail = preferences.GetString("username", ""); if (string.IsNullOrWhiteSpace(UserEmail)) { // We must clear the navigation stack here otherwise this activity is behind onboarding. var intent = new Intent(this, typeof(Activities.Onboarding)); intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.ClearTask); StartActivity(intent); Finish(); } else { // Create the user once as they can come here after Register/Login or anytime they reopen app if (Session.ActiveUser == null) { var user = Queries.UserByEmail(UserEmail); var tokens = JsonConvert.DeserializeObject <JWToken>(preferences.GetString("tokens", "")); Queries.SetActiveUser(new DataUserTokens { User = user, Tokens = tokens }); firebaseAnalytics.SetUserId(Session.ActiveUser.Id.ToString()); } var nav = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation); nav.Menu.FindItem(Resource.Id.menu_projects).SetTitle(StringResources.common_menu_projects); nav.Menu.FindItem(Resource.Id.menu_gabbers).SetTitle(StringResources.common_menu_gabbers); nav.Menu.FindItem(Resource.Id.menu_about).SetTitle(StringResources.common_menu_about); nav.NavigationItemSelected += (sender, e) => LoadFragment(e.Item.ItemId); // Load projects by default and sessions/about if they came from other activity. LoadDefaultFragment(nav); } }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(ApplicationContext); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.record); SupportActionBar.Title = StringResources.recording_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var instructionsHeader = FindViewById <TextView>(Resource.Id.recordInstructionsHeader); instructionsHeader.Text = StringResources.recording_ui_instructions_header; InterviewSessionID = Guid.NewGuid().ToString(); var _prefs = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); ConsentType = _prefs.GetString("SESSION_CONSENT", ""); SelectedProjectID = _prefs.GetInt("SelectedProjectID", 0); langId = _prefs.GetInt("SESSION_LANG", 1); var selectedProject = Queries.ProjectById(SelectedProjectID); RecyclerView promptRecyclerView = FindViewById <RecyclerView>(Resource.Id.prompts); promptRecyclerView.SetLayoutManager(new GridLayoutManager(this, 1)); Content project = LanguageChoiceManager.ContentByLanguage(selectedProject, langId); List <Topic> activeTopics = project.Topics.Where((p) => p.IsActive).ToList(); themes = activeTopics; adapter = new TopicAdapter(themes); adapter.ProjectClicked += CheckRecPerm; promptRecyclerView.SetAdapter(adapter); record = FindViewById <FloatingActionButton>(Resource.Id.start); FindViewById <TextView>(Resource.Id.themeTitle).Text = project.Title; Color highlightColor = new Color(ContextCompat.GetColor(this, Resource.Color.colorControlHighlight)); ViewCompat.SetBackgroundTintList(record, Android.Content.Res.ColorStateList.ValueOf(highlightColor)); record.Enabled = false; timer = FindViewById <TextView>(Resource.Id.timer); timer.SetTextColor(highlightColor); record.Click += HandleRecordClick; }
//Nuevo metodo public void GetTipoUsu() { if (File.Exists(App.FileUsu)) { string TipoUsu = File.ReadAllText(App.FileUsu); mFirebaseAnalytics = FirebaseAnalytics.GetInstance(MainActivity.getmInstanceActivity()); mFirebaseAnalytics.SetUserProperty("Tipo_Usuario", TipoUsu); } else { mFirebaseAnalytics = FirebaseAnalytics.GetInstance(MainActivity.getmInstanceActivity()); mFirebaseAnalytics.SetUserProperty("Tipo_Usuario", "Invitado"); } }
protected override void OnCreate(Bundle bundle) { RequestedOrientation = ScreenOrientation.Portrait; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; var firebase = FirebaseAnalytics.GetInstance(this); firebase.LogEvent(FirebaseAnalytics.Event.AppOpen, null); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
public void LogEvent(string eventId, IDictionary <string, string> parameters) { var firebaseAnalytics = FirebaseAnalytics.GetInstance(Android.App.Application.Context); if (parameters == null) { firebaseAnalytics.LogEvent(eventId, null); return; } var bundle = new Bundle(); foreach (var item in parameters) { bundle.PutString(item.Key, item.Value); } firebaseAnalytics.LogEvent(eventId, bundle); }
public static void UserLoginSignup(String signupMethod, Boolean isSignup = false) { var bundle = new Bundle(); bundle.PutString(FirebaseAnalytics.Param.SignUpMethod, signupMethod); if (analytics == null) { analytics = FirebaseAnalytics.GetInstance(Application.Context); } if (isSignup) { analytics.LogEvent(FirebaseAnalytics.Event.SignUp, bundle); } else { analytics.LogEvent(FirebaseAnalytics.Event.Login, bundle); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); if (GetString(Resource.String.google_app_id) == "YOUR-APP-ID") { throw new System.Exception("Invalid google-services.json file. Make sure you've downloaded your own config file and added it to your app project with the 'GoogleServicesJson' build action."); } // [START shared_app_measurement] // Obtain the FirebaseAnalytics instance. firebaseAnalytics = FirebaseAnalytics.GetInstance(this); // [END shared_app_measurement] // On first app open, ask the user his/her favorite food. Then set this as a user property // on all subsequent opens. var userFavoriteFood = GetUserFavoriteFood(); if (userFavoriteFood == null) { AskFavoriteFood(); } else { SetUserFavoriteFood(userFavoriteFood); } // Create the adapter that will return a fragment for each image. imagePagerAdapter = new ImagePagerAdapter(SupportFragmentManager, IMAGE_INFOS, this); // Set up the ViewPager with the pattern adapter. viewPager = FindViewById <ViewPager> (Resource.Id.pager); viewPager.Adapter = imagePagerAdapter; // When the visible image changes, send a screen view hit. viewPager.PageSelected += (sender, e) => { RecordImageView(); }; // Send initial screen screen view hit. RecordImageView(); }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(savedInstanceState); Helpers.Localise.SetLayoutDirectionByCulture(this); SetContentView(Resource.Layout.register_verification); FindViewById <TextView>(Resource.Id.verifyTitle).Text = StringResources.register_verify_ui_page_title; var email = Intent.GetStringExtra("EMAIL_USED_TO_REGISTER"); FindViewById <TextView>(Resource.Id.verifyContent).Text = string.Format(StringResources.register_verify_ui_page_content, email); var intent = new Intent(Intent.ActionMain); intent.SetFlags(ActivityFlags.NewTask); intent.AddCategory(Intent.CategoryAppEmail); if (intent.ResolveActivity(PackageManager) != null) { var openEmail = FindViewById <AppCompatButton>(Resource.Id.openEmail); openEmail.Text = StringResources.register_verify_ui_button_openemail; openEmail.Click += (s, e) => { LOG_EVENT_WITH_ACTION("EMAIL_CLIENT", "CLICK_OPENED"); StartActivity(intent); }; openEmail.Visibility = Android.Views.ViewStates.Visible; } else { LOG_EVENT_WITH_ACTION("EMAIL_CLIENT", "NOT_SHOWN"); } FindViewById <TextView>(Resource.Id.loginContent).Text = StringResources.register_verify_ui_page_subcontent; var login = FindViewById <AppCompatButton>(Resource.Id.loginButton); login.Text = StringResources.login_ui_submit_button; login.Click += (s, e) => { LOG_EVENT_WITH_ACTION("LOGIN_BUTTON", "CLICKED"); StartActivity(typeof(LoginActivity)); }; }
private void SendEvent(string eventName, Dictionary <string, string> parameters) { var firebaseAnalytics = FirebaseAnalytics.GetInstance(Android.App.Application.Context); if (parameters == null) { firebaseAnalytics.LogEvent(eventName, null); return; } var bundle = new Bundle(); foreach (var param in parameters) { bundle.PutString(param.Key, param.Value); } firebaseAnalytics.LogEvent(eventName, bundle); }
public void LogEvent(string eventId, IDictionary <string, string> parameters) { // utility method to fix eventId, you can skip it if you are sure to always pass valid eventIds eventId = FixEventId(eventId); var fireBaseAnalytics = FirebaseAnalytics.GetInstance(CrossCurrentActivity.Current.AppContext); if (parameters == null) { fireBaseAnalytics.LogEvent(eventId, null); return; } var bundle = new Bundle(); foreach (var item in parameters) { bundle.PutString(item.Key, item.Value); } fireBaseAnalytics.LogEvent(eventId, bundle); }
public void SendEvent(string eventId, IDictionary <string, string> parameters) { var firebaseAnalytics = FirebaseAnalytics.GetInstance(Forms.Context); if (parameters == null) { firebaseAnalytics.LogEvent(eventId, null); return; } var bundle = new Bundle(); foreach (var param in parameters) { bundle.PutString(param.Key, param.Value); } firebaseAnalytics.LogEvent(eventId, bundle); }