protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.google); mGsignBtn = FindViewById <SignInButton>(Resource.Id.sign_in_button); TxtGender = FindViewById <TextView>(Resource.Id.TxtGender); TxtName = FindViewById <TextView>(Resource.Id.TxtName); ImgProfile = FindViewById <ImageView>(Resource.Id.ImgProfile); Button button1 = FindViewById <Button>(Resource.Id.buttonTasks); button1.Click += Button_Click; mGsignBtn.Click += MGsignBtn_Click; GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); builder.AddApi(PlusClass.API); builder.AddScope(PlusClass.ScopePlusProfile); builder.AddScope(PlusClass.ScopePlusLogin); //Build our IGoogleApiClient mGoogleApiClient = builder.Build(); }
private void CreateClient() { var builder = new GoogleApiClient.Builder(activity, this, this); builder.AddApi(GamesClass.API); builder.AddScope(GamesClass.ScopeGames); if (ViewForPopups != null) { builder.SetViewForPopups(ViewForPopups); } client = builder.Build(); }
private void CreateClient() { // did we log in with a player id already? If so we don't want to ask which account to use var settings = this.activity.GetSharedPreferences("googleplayservicessettings", FileCreationMode.Private); var id = settings.GetString("playerid", String.Empty); var builder = new GoogleApiClient.Builder(activity, this, this); builder.AddApi(Android.Gms.Games.GamesClass.API); builder.AddScope(Android.Gms.Games.GamesClass.ScopeGames); builder.SetGravityForPopups((int)GravityForPopups); if (ViewForPopups != null) { builder.SetViewForPopups(ViewForPopups); } if (!string.IsNullOrEmpty(id)) { builder.SetAccountName(id); } client = builder.Build(); }
private void CreateClient() { // did we log in with a player id already? If so we don't want to ask which account to use var settings = this.activity.GetSharedPreferences ("googleplayservicessettings", FileCreationMode.Private); var id = settings.GetString ("playerid", String.Empty); var builder = new GoogleApiClient.Builder (activity, this, this); builder.AddApi (Android.Gms.Games.GamesClass.API); builder.AddScope (Android.Gms.Games.GamesClass.ScopeGames); builder.SetGravityForPopups ((int)GravityForPopups); if (ViewForPopups != null) builder.SetViewForPopups (ViewForPopups); if (!string.IsNullOrEmpty (id)) { builder.SetAccountName (id); } client = builder.Build (); }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder1 = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder1.Build()); StrictMode.ThreadPolicy.Builder builder2 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder2.Build()); base.OnCreate(savedInstanceState); restService = new ServiceHelper(); SetContentView(Resource.Layout.LoginLayout); GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); builder.AddApi(PlusClass.API); builder.AddScope(PlusClass.ScopePlusProfile); builder.AddScope(PlusClass.ScopePlusLogin); //Build our IGoogleApiClient mGoogleApiClient = builder.Build(); // mGoogleApiClient.Disconnect(); mGsignBtn = FindViewById <SignInButton>(Resource.Id.sign_in_button); TextView txtenglish = FindViewById <TextView>(Resource.Id.english); TextView txthindi = FindViewById <TextView>(Resource.Id.hindi); txtenglish.SetText(Resource.String.stportal); txthindi.SetText(Resource.String.stportalhindi); pref = GetSharedPreferences("login", FileCreationMode.Private); edit = pref.Edit(); user = FindViewById <EditText>(Resource.Id.username); pass = FindViewById <EditText>(Resource.Id.pass); log = FindViewById <Button>(Resource.Id.login); register = FindViewById <Button>(Resource.Id.regis); log.Click += delegate { UserLogin(); }; register.Click += delegate { var intent6 = new Intent(this, typeof(Registration_Activity)); StartActivityForResult(intent6, 106); }; mGsignBtn.Click += delegate { if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.GetAccounts) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.GetAccounts)) { } else { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.GetAccounts }, 115); } } else { // DoAuthentication("*****@*****.**", "", "Deepanshu Mishra"); if (!mGoogleApiClient.IsConnecting) { mSignInClicked = true; ResolveSignInError(); } else if (mGoogleApiClient.IsConnected) { PlusClass.AccountApi.ClearDefaultAccount(mGoogleApiClient); mGoogleApiClient.Disconnect(); } } }; }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); SetContentView(Resource.Layout.Login); txtUserName = FindViewById <EditText>(Resource.Id.etEmailPhone); txtPassword = FindViewById <EditText>(Resource.Id.etPassword); txtForgotUsername = FindViewById <EditText>(Resource.Id.etForgotUsername); btnLogIn = FindViewById <Button>(Resource.Id.btnLogin); GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); builder.AddApi(PlusClass.API); builder.AddScope(new Scope(Scopes.PlusLogin)); mGoogleApiClient = builder.Build(); mGoogleApiClient.Connect(); if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.primaryDark))); } ISharedPreferences prefs = Application.Context.GetSharedPreferences("WeClip", FileCreationMode.Private); var FromUserScreen = Intent.GetStringExtra("FromUserName"); if (!string.IsNullOrEmpty(FromUserScreen)) { var prefEditor = prefs.Edit(); prefEditor.PutBoolean("RegisterEmail", false); prefEditor.PutBoolean("RegisterPhone", false); prefEditor.Commit(); } bool RegisterEmail = prefs.GetBoolean("RegisterEmail", false); bool RegisterPhone = prefs.GetBoolean("RegisterPhone", false); llayoutSignIn = FindViewById <LinearLayout>(Resource.Id.llayoutSignIn); llayoutSignUpOptions = FindViewById <LinearLayout>(Resource.Id.llayoutSignUpOptions); llayoutForgotPassword = FindViewById <LinearLayout>(Resource.Id.llayoutForgot); btnSignUpWsocial = FindViewById <TextView>(Resource.Id.btnSignUpWsocial); btnSignUpWsocial.Click += BtnSignUpWsocial_Click; btnSignInView = FindViewById <TextView>(Resource.Id.btnSignInView); btnSignInView.Click += BtnSignInView_Click; btnForgotPassword = FindViewById <TextView>(Resource.Id.btnForgotPassword); btnForgotPassword.Click += BtnForgotPassword_Click; btnsignInInForgotPassword = FindViewById <TextView>(Resource.Id.tvSigninInForgotPassword); btnsignInInForgotPassword.Click += BtnSigninForgotPassword_Click; btnSignupWithEmail = FindViewById <Button>(Resource.Id.btnSignUpWithEmail); btnSignupWithPhone = FindViewById <Button>(Resource.Id.btnSignUpWithPhone); btnSignupWithGoogle = FindViewById <Button>(Resource.Id.btnGPlus); btnSignUpWithFacebook = FindViewById <Button>(Resource.Id.btnFacebook); btnSumitForgotPassword = FindViewById <Button>(Resource.Id.btnSubmitForgotPassword); mcallBackManager = CallbackManagerFactory.Create(); btnSignupWithPhone.Visibility = ViewStates.Gone; LoginManager.Instance.RegisterCallback(mcallBackManager, this); btnSignupWithEmail.Click += btnSignupWithEmail_Click; btnSignupWithPhone.Click += BtnSignupWithPhone_Click; btnSignupWithGoogle.Click += BtnSignupWithGoogle_Click; btnSignUpWithFacebook.Click += BtnSignUpWithFacebook_Click; btnSumitForgotPassword.Click += BtnSumitForgotPassword_Click; btnLogIn.Click += BtnLogIn_Click; if (RegisterEmail == true) { SignUpView(); } } catch (Java.Lang.Exception ex) { new CrashReportAsync("LoginActivity", "OnCreate", ex.Message + ex.StackTrace).Execute(); } }