Created
August 17, 2018 13:44
-
-
Save vprabhu/88d31b0dbf9f6a3e9600e1b4eebfe86b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_login) | |
// initialise the FirebaseAuth instance | |
mAuth = FirebaseAuth.getInstance() | |
// Configure Google Sign In | |
mGoogleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | |
.requestIdToken(getString(R.string.default_web_client_id)) | |
.requestEmail() | |
.build() | |
// configure the GoogleApiClient | |
mGoogleApiClient = GoogleApiClient | |
.Builder(this) | |
.enableAutoManage(this , this).addApi(Auth.GOOGLE_SIGN_IN_API , mGoogleSignInOptions).build() | |
button_login.setOnClickListener { | |
if(isUserLoggedIn){ | |
doLogout() | |
}else{ | |
doLogin() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment