private void resolveGoogleLogin(ConnectionResult result) { if (result.HasResolution) { try { result.StartResolutionForResult(this, 9000); } catch (Android.Content.IntentSender.SendIntentException) { plusClient.Connect(); } } }
// Attempts to connect the client to Google Play services if the client isn't already connected, // and isn't in the process of being connected. private void connectPlusClient() { if (!mPlusClient.IsConnecting() && !mPlusClient.IsConnected()) { mPlusClient.Connect(); } }
void ConnectCurrentClient() { switch (clientCurrentlyConnecting) { case CLIENT_GAMES: gamesClient.Connect(); break; case CLIENT_APPSTATE: appStateClient.Connect(); break; case CLIENT_PLUS: plusCient.Connect(); break; } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (requestCode != REQUEST_CODE_RESOLVE_ERR) { return; } if (resultCode == Result.Ok) { plusClient.Connect(); } else { progressDialog.Dismiss(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); imageLoader = new ImageLoader(this); progressDialog = new ProgressDialog(this); progressDialog.Indeterminate = true; progressDialog.SetMessage("Connecting"); plusClient = new PlusClient.Builder(this, this, this).Build(); googleLoginButton = FindViewById <SignInButton> (Resource.Id.sign_in_button); plusOneButton = FindViewById <PlusOneButton> (Resource.Id.plus_one_button); var logoutButton = FindViewById <Button> (Resource.Id.logout_button); logoutButton.Click += (sender, e) => { if (!plusClient.IsConnected || plusClient.IsConnecting) { return; } plusClient.RevokeAccessAndDisconnect(this); }; googleLoginButton.Click += (sender, e) => { if (plusClient.IsConnected || plusClient.IsConnecting) { return; } progressDialog.Show(); if (connectionResult == null) { plusClient.Connect(); } else { ResolveLogin(connectionResult); } }; plusClient.RegisterConnectionCallbacks(this); plusClient.IsConnectionFailedListenerRegistered(this); }
override protected void OnStart() { base.OnStart(); mPlusClient.Connect(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Login); Console.WriteLine("LoginActivity"); ImageView logo = FindViewById <ImageView> (Resource.Id.ActionBarLogo); logo.Visibility = ViewStates.Invisible; ImageView menu = FindViewById <ImageView> (Resource.Id.ActionBarMenu); menu.Visibility = ViewStates.Invisible; TextView title = FindViewById <TextView> (Resource.Id.ActionBarTitle); title.Text = "Login"; Button back = FindViewById <Button> (Resource.Id.ActionBarBack); back.Click += delegate { Finish(); }; EditText email = FindViewById <EditText> (Resource.Id.Email); EditText password = FindViewById <EditText> (Resource.Id.Password); email.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { }; password.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { }; ImageButton facebook = FindViewById <ImageButton> (Resource.Id.loginViaFacebook); facebook.Click += delegate { var webAuth = new Intent(this, typeof(FBWebViewAuthActivity)); webAuth.PutExtra("AppId", AppId); webAuth.PutExtra("ExtendedPermissions", ExtendedPermissions); StartActivityForResult(webAuth, 0); }; ImageButton googlePlus = FindViewById <ImageButton> (Resource.Id.loginViaGoogle); plusClient = new PlusClient.Builder(this, this, this).Build(); plusClient.RegisterConnectionCallbacks(this); plusClient.IsConnectionFailedListenerRegistered(this); googlePlus.Click += (object sender, EventArgs e) => { if (plusClient.IsConnected || plusClient.IsConnecting) { return; } if (connectionResult == null) { plusClient.Connect(); } else { resolveGoogleLogin(connectionResult); } }; main = new Intent(this, typeof(MainTabActivity)); Button login = FindViewById <Button> (Resource.Id.loginButton); login.Click += delegate { Globals.DeleteProfileId(); var request = new RestRequest(); request.RequestFinished += (object sender, RequestEndedArgs e) => { RunOnUiThread(delegate { var id = (string)JsonConvert.DeserializeObject(e.Result, typeof(string)); Globals.SaveProfileId(id); StartActivity(main); }); }; request.Send(RequestConfig.Login, "POST", new LoginModel { Email = email.Text.Trim(), Password = password.Text.Trim(), RememberMe = true }); }; Button forgotPass = FindViewById <Button> (Resource.Id.forgotPassButton); var forgotPassActivity = new Intent(this, typeof(ForgotPassActivity)); forgotPass.Click += delegate { StartActivity(forgotPassActivity); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); imageLoader = new ImageLoader (this); progressDialog = new ProgressDialog (this); progressDialog.Indeterminate = true; progressDialog.SetMessage ("Connecting"); plusClient = new PlusClient.Builder(this, this, this).Build(); googleLoginButton = FindViewById<SignInButton> (Resource.Id.sign_in_button); plusOneButton = FindViewById<PlusOneButton> (Resource.Id.plus_one_button); var logoutButton = FindViewById<Button> (Resource.Id.logout_button); logoutButton.Click += (sender, e) => { if(!plusClient.IsConnected || plusClient.IsConnecting) return; plusClient.RevokeAccessAndDisconnect(this); }; googleLoginButton.Click += (sender, e) => { if(plusClient.IsConnected || plusClient.IsConnecting) return; progressDialog.Show(); if (connectionResult == null) { plusClient.Connect(); } else{ ResolveLogin(connectionResult); } }; plusClient.RegisterConnectionCallbacks (this); plusClient.IsConnectionFailedListenerRegistered (this); }