示例#1
0
        GoogleApiClient buildGoogleApiClient(bool useProfileScope)
        {
            var builder = new GoogleApiClient.Builder(this)
                          .AddConnectionCallbacks(this)
                          .AddOnConnectionFailedListener(this);

            var serverClientId = GetString(Resource.String.server_client_id);

            //if (!string.IsNullOrEmpty (serverClientId))
            //    builder.RequestServerAuthCode (serverClientId, this);

            if (useProfileScope)
            {
                builder.AddApi(PlusClass.API)
                .AddScope(PlusClass.ScopePlusProfile);
            }
            else
            {
                //var options = new PlusClass.PlusOptions.Builder ().AddActivityTypes (MomentUtil.ACTIONS).Build ();
                builder.AddApi(PlusClass.API)  //, options)
                .AddScope(PlusClass.ScopePlusLogin);
            }

            return(builder.Build());
        }
示例#2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Register);
            Button register_farmer = FindViewById <Button>(Resource.Id.button1);
            Button register_muc    = FindViewById <Button>(Resource.Id.button2);

            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();
            register_farmer.Click += delegate
            {
                user_type = 2;
                if (!mGoogleApiClient.IsConnecting)
                {
                    mSignInClicked = true;
                    ResolveSignInError();
                }
            };
            register_muc.Click += delegate
            {
                user_type = 3;
                if (!mGoogleApiClient.IsConnecting)
                {
                    mSignInClicked = true;
                    ResolveSignInError();
                }
            };
        }
示例#3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.login);

            //skip login
            //GoToMainPage(1);

            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);
            googleApiClient = builder.Build();


            etEmail         = FindViewById <EditText>(Resource.Id.TextEmail);
            etPass          = FindViewById <EditText>(Resource.Id.TextPass);
            btnOK           = FindViewById <Button>(Resource.Id.buttonOk);
            btnGoogleSignIn = FindViewById <SignInButton>(Resource.Id.sign_in_button);


            btnOK.Click           += BtnOK_Click;
            btnGoogleSignIn.Click += BtnGoogleSignIn_Click;
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            System.Diagnostics.Debug.WriteLine("In login page...");
            SetContentView(Resource.Layout.Login);
            mGoogleSignIn = FindViewById <SignInButton>(Resource.Id.sign_in_button);
            Android.Widget.Button b2 = FindViewById <Android.Widget.Button>(Resource.Id.button1);
            b2.Click += delegate
            {
                StartActivity(typeof(register));
            };

            mGoogleSignIn.Click += mGoogleSignIn_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();
        }
示例#5
0
        public void Register(Context context)
        {
            this.context = context;

            GoogleApiClient.Builder builder = new GoogleApiClient.Builder(context, this, this);
            builder.AddApi(DriveClass.API);
            builder.AddScope(DriveClass.ScopeFile);

            client = builder.Build();
        }
示例#6
0
 private void ConfigurateGoogleSigin()
 {
     GoogleApiClient.Builder gBuilder = new GoogleApiClient.Builder(this);
     gBuilder.AddConnectionCallbacks(this);
     gBuilder.AddOnConnectionFailedListener(this);
     gBuilder.AddApi(PlusClass.API);
     gBuilder.AddScope(PlusClass.ScopePlusProfile);
     gBuilder.AddScope(PlusClass.ScopePlusLogin);
     oGoogleApiClient = gBuilder.Build();
 }
示例#7
0
        public static void CreateBuilder()
        {
            var googleCallbacks = new GoogleCallback();

            Builder = new GoogleApiClient.Builder(Forms.Context);
            Builder.AddConnectionCallbacks(googleCallbacks);
            Builder.AddOnConnectionFailedListener(googleCallbacks);
            Builder.AddApi(PlusClass.API);
            Builder.AddScope(PlusClass.ScopePlusLogin);
            Builder.AddScope(PlusClass.ScopePlusProfile);

            MyGoogleApiClient = Builder.Build();
        }
示例#8
0
        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.AddApi(Android.Gms.Drive.DriveClass.API);
            builder.AddScope(Android.Gms.Drive.DriveClass.ScopeAppfolder);
            builder.SetGravityForPopups((int)GravityForPopups);
            if (ViewForPopups != null)
            {
                builder.SetViewForPopups(ViewForPopups);
            }
            if (!string.IsNullOrEmpty(id))
            {
                builder.SetAccountName(id);
            }
            client = builder.Build();
        }
示例#9
0
        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();
        }
示例#10
0
        internal GoogleClientManager()
        {
            if (CurrentActivity == null)
            {
                GoogleClientErrorEventArgs errorEventArgs = new GoogleClientErrorEventArgs();
                Exception exception = null;

                errorEventArgs.Error   = GoogleClientErrorType.SignInInternalError;
                errorEventArgs.Message = GoogleClientBaseException.SignInInternalErrorMessage;
                exception = new GoogleClientSignInInternalErrorException();

                _loginTcs.TrySetException(exception);
            }

            var gopBuilder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                             .RequestEmail();

            if (!string.IsNullOrWhiteSpace(_serverClientId))
            {
                gopBuilder.RequestServerAuthCode(_serverClientId, false);
            }

            if (!string.IsNullOrWhiteSpace(_clientId))
            {
                gopBuilder.RequestIdToken(_clientId);
            }

            foreach (var s in _initScopes)
            {
                gopBuilder.RequestScopes(new Scope(s));
            }

            GoogleSignInOptions googleSignInOptions = gopBuilder.Build();

            var googleApiClientBuilder = new GoogleApiClient.Builder(Application.Context)
                                         .AddConnectionCallbacks(this)
                                         .AddOnConnectionFailedListener(this)
                                         .AddApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions);

            foreach (var a in _initApis)
            {
                googleApiClientBuilder.AddApi(a);
            }

            GoogleApiClient = googleApiClientBuilder.Build();
        }
示例#11
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     // Set our view from the "main" layout resource
     SetContentView(Resource.Layout.Main);
     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);
     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();
 }
示例#12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            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);
            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();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            restService = new ServiceHelper();

            SetContentView(Resource.Layout.GoogleAuth_Layout);
            pref = GetSharedPreferences("login", FileCreationMode.Private);
            edit = pref.Edit();

            // mGsignBtn = FindViewById<SignInButton>(Resource.Id.sign_in_button);

            mGsignBtn  = FindViewById <Button>(Resource.Id.sign_in_button);
            TxtEmail   = FindViewById <TextView>(Resource.Id.TxtGender);
            TxtName    = FindViewById <TextView>(Resource.Id.TxtName);
            ImgProfile = FindViewById <ImageView>(Resource.Id.ImgProfile);
            Button Submit = FindViewById <Button>(Resource.Id.submit);

            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);
                }
            }


            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();
        }
示例#14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            NeedToLoadUser();
            SetContentView(Resource.Layout.activity_logIn);
            editTextEmail    = FindViewById <EditText>(Resource.Id.editTextEmail);
            editTextPassword = FindViewById <EditText>(Resource.Id.editTextPassword);
            InitListeners();

            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);
            mGoogleApiClient = builder.Build();

            FacebookSdk.SdkInitialize(this.ApplicationContext);
            fbCallbackManager = CallbackManagerFactory.Create();
            LoginManager.Instance.RegisterCallback(fbCallbackManager, this);
            InitFacebookListener();
        }
        internal GoogleClientManager()
        {
            if (CurrentActivity == null)
            {
                throw new GoogleClientNotInitializedErrorException(GoogleClientBaseException.ClientNotInitializedErrorMessage);
            }

            var gopBuilder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                             .RequestEmail();

            if (!string.IsNullOrWhiteSpace(_serverClientId))
            {
                gopBuilder.RequestServerAuthCode(_serverClientId, false);
            }

            if (!string.IsNullOrWhiteSpace(_clientId))
            {
                gopBuilder.RequestIdToken(_clientId);
            }

            foreach (var s in _initScopes)
            {
                gopBuilder.RequestScopes(new Scope(s));
            }

            GoogleSignInOptions googleSignInOptions = gopBuilder.Build();

            var googleApiClientBuilder = new GoogleApiClient.Builder(Application.Context)
                                         .AddConnectionCallbacks(this)
                                         .AddOnConnectionFailedListener(this)
                                         .AddApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions);

            foreach (var a in _initApis)
            {
                googleApiClientBuilder.AddApi(a);
            }

            GoogleApiClient = googleApiClientBuilder.Build();
        }
示例#16
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = base.OnCreateView(inflater, container, savedInstanceState);

            _facebookLoginButton        = view.FindViewById <Button>(Resource.Id.facebookLoginButton);
            _facebookLoginButton.Click += OnFacebookLoginButtonClicked;

            _googleSignBtn        = view.FindViewById <Button>(Resource.Id.sign_in_button);
            _googleSignBtn.Click += GetPermissions;

            _user = new GoogleUserModel();

            GoogleApiClient.Builder builder = new GoogleApiClient.Builder(Context);
            builder.AddConnectionCallbacks(this);
            builder.AddOnConnectionFailedListener(this);
            builder.AddApi(PlusClass.API);
            builder.AddScope(PlusClass.ScopePlusProfile);
            builder.AddScope(PlusClass.ScopePlusLogin);

            _googleApiClient = builder.Build();

            return(view);
        }
示例#17
0
        GoogleApiClient buildGoogleApiClient (bool useProfileScope)
        {
            var builder = new GoogleApiClient.Builder (this)
                .AddConnectionCallbacks (this)
                .AddOnConnectionFailedListener (this);

            var serverClientId = GetString (Resource.String.server_client_id);

            if (!string.IsNullOrEmpty (serverClientId))
                builder.RequestServerAuthCode (serverClientId, this);

            if (useProfileScope) {
                builder.AddApi (PlusClass.API)
                    .AddScope (PlusClass.ScopePlusProfile);
            } else {
                builder.AddApi (PlusClass.API, new PlusClass.PlusOptions.Builder ()
                    .AddActivityTypes (MomentUtil.ACTIONS).Build ())
                    .AddScope (PlusClass.ScopePlusLogin);
            }

            return builder.Build ();
        }
示例#18
0
		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();
            }
        }