Guest User

Untitled

a guest
Nov 14th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. package com.example.argon.schoolplies;
  2.  
  3. import android.content.Intent;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8.  
  9. import com.google.android.gms.auth.api.signin.GoogleSignIn;
  10.  
  11. import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
  12.  
  13. public class loginActivity extends AppCompatActivity implements View.OnClickListener{
  14.  
  15.  
  16.  
  17. @Override
  18. protected void onCreate(Bundle savedInstanceState) {
  19. super.onCreate(savedInstanceState);
  20. setContentView(R.layout.activity_login);
  21.  
  22. // Configure sign-in to request the user's ID, email address, and basic
  23. // profile. ID and basic profile are included in DEFAULT_SIGN_IN.
  24. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
  25. .requestEmail()
  26. .build();
  27.  
  28. // Build a GoogleSignInClient with the options specified by gso.
  29. mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
  30.  
  31.  
  32. Button gButton = findViewById(R.id.sign_in_button);
  33. gButton.setOnClickListener(this);
  34. }
  35.  
  36. @Override
  37. public void onClick(View v){
  38.  
  39. switch (v.getId()) {
  40. case R.id.sign_in_button:
  41. signIn();
  42. break;
  43. // ...
  44. }
  45.  
  46. }
  47.  
  48. private void signIn() {
  49. Intent signInIntent = mGoogleSignInClient.getSignInIntent();
  50. startActivityForResult(signInIntent, RC_SIGN_IN);
  51. }
  52.  
  53.  
  54. //end of main class
  55. }
Advertisement
Add Comment
Please, Sign In to add comment