//IOnCompleteListener //create a listener called when a Task completes public void OnComplete(Task task) { if (task.IsSuccessful) { //get the current user register FirebaseUser user = auth.CurrentUser; //sending email verification to the email user.SendEmailVerification() .AddOnCompleteListener(this, this); //changing the form to maintactivity var uri = Android.Net.Uri.Parse("https://mail.google.com"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); //StartActivity(new Intent(this, typeof(MainActivity))); //close the current form Finish(); //create a toast if the register is success Toast.MakeText(this, "Successfully Registered please verify your account", ToastLength.Short).Show(); } else { //create a toast if the registration failed Toast.MakeText(this, "Failed Register", ToastLength.Short).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DashBoard); //Init Firebase auth = FirebaseAuth.GetInstance(MainActivity.app); //Add Toolbar Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); toolbar.Title = "Firebase Database"; SetSupportActionBar(toolbar); //View //circular_progress = FindViewById<ProgressBar>(Resource.Id.circularProgress); dashboard_btn_view_image = FindViewById <Button>(Resource.Id.dashboard_btn_view_image); dashboard_btn_upload_image = FindViewById <Button>(Resource.Id.dashboard_btn_upload_image); viewDataButton = FindViewById <Button>(Resource.Id.dashboard_btn_view_data); subscribeButton = FindViewById <Button>(Resource.Id.dashboard_btn_subscribe); btnNewName = FindViewById <Button>(Resource.Id.dashboard_btn_new_name); newName = FindViewById <EditText>(Resource.Id.dashboard_newname); btnChangePass = FindViewById <Button>(Resource.Id.dashboard_btn_change_pass); txtWelcome = FindViewById <TextView>(Resource.Id.dashboard_welcome); btnLogout = FindViewById <Button>(Resource.Id.dashboard_btn_logout); input_new_password = FindViewById <EditText>(Resource.Id.dashboard_newpassword); activity_dashboard = FindViewById <RelativeLayout>(Resource.Id.activity_dashboard); btnChangePass.SetOnClickListener(this); btnLogout.SetOnClickListener(this); btnNewName.SetOnClickListener(this); subscribeButton.SetOnClickListener(this); viewDataButton.SetOnClickListener(this); dashboard_btn_upload_image.SetOnClickListener(this); dashboard_btn_view_image.SetOnClickListener(this); btnChangePass.Text = MainActivity.decision; //Check Session if (auth != null) { FirebaseUser current = auth.CurrentUser; if (!current.IsEmailVerified) { current.SendEmailVerification(); txtWelcome.Text = "Email not verified. Features unavailable"; } else { txtWelcome.Text = "Welcome , " + auth.CurrentUser.Email; } } }