use of com.google.android.gms.auth.api.signin.GoogleSignInAccount in project YourAppIdea by Michenux.
the class GoogleAuthDelegate method handleSignInResult.
private void handleSignInResult(GoogleSignInResult result) {
if (BuildConfig.DEBUG) {
Log.d(MCXApplication.LOG_TAG, "handleSignInResult:" + result.isSuccess() + " " + result.getStatus().getStatusCode() + result.getStatus().hasResolution());
}
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
User user = new User();
user.setProvider(PROVIDER_NAME);
user.setProviderDisplayName("Google+");
user.setUserId(acct.getId());
user.setUserName(acct.getId());
user.setDisplayName(acct.getDisplayName());
user.setMail(acct.getEmail());
this.mUserHelper.setCurrentUser(user);
if (this.mUserSessionCallback != null) {
this.mUserSessionCallback.onLogin();
}
} else {
// Signed out, show unauthenticated UI.
this.mUserSessionCallback.onLogout();
}
}
use of com.google.android.gms.auth.api.signin.GoogleSignInAccount in project quickstart-android by firebase.
the class GoogleSignInFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
Log.d(TAG, "firebaseAuthWithGoogle:" + account.getId());
firebaseAuthWithGoogle(account.getIdToken());
} catch (ApiException e) {
// Google Sign In failed, update UI appropriately
Log.w(TAG, "Google sign in failed", e);
updateUI(null);
}
}
}
use of com.google.android.gms.auth.api.signin.GoogleSignInAccount in project Andela-Med-Manager by jumaallan.
the class AuthActivity method handleSignInResult.
private void handleSignInResult(GoogleSignInResult result) {
Timber.d("handleSignInResult:" + result.isSuccess() + " " + result.getStatus());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
assert acct != null;
String name = acct.getDisplayName();
String imageUrl = String.valueOf(acct.getPhotoUrl());
/*
* Save to Room DB
* Set the Logged in status to true
* Navigate user to Main Activity
*/
addUserViewModel.addUser(new User("1", name, imageUrl));
Settings.setLoggedInSharedPref(true);
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
}
}
use of com.google.android.gms.auth.api.signin.GoogleSignInAccount in project AndelaMedManager by jumaallan.
the class AuthActivity method handleSignInResult.
private void handleSignInResult(GoogleSignInResult result) {
Timber.d("handleSignInResult:" + result.isSuccess() + " " + result.getStatus());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
assert acct != null;
String name = acct.getDisplayName();
String imageUrl = String.valueOf(acct.getPhotoUrl());
/*
* Save to Room DB
* Set the Logged in status to true
* Navigate user to Main Activity
*/
addUserViewModel.addUser(new User("1", name, imageUrl));
Settings.setLoggedInSharedPref(true);
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
}
}
use of com.google.android.gms.auth.api.signin.GoogleSignInAccount in project Passenger_Security by ujjwalagr.
the class GoogleLogin method handleresult.
private void handleresult(GoogleSignInResult result) {
if (result.isSuccess()) {
GoogleSignInAccount account = result.getSignInAccount();
nameget = account.getDisplayName();
emailget = account.getEmail();
img_url = account.getPhotoUrl().toString();
Toast.makeText(this, "Welcome " + nameget, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(GoogleLogin.this, HomeScreen.class);
intent.putExtra("name", nameget).putExtra("urlimg", img_url).putExtra("email", emailget);
startActivity(intent);
finish();
} else {
Toast.makeText(this, "Unsuccessful login", Toast.LENGTH_SHORT).show();
}
}
Aggregations