Java Code Examples for com.google.android.gms.auth.api.signin.GoogleSignInAccount#getId()
The following examples show how to use
com.google.android.gms.auth.api.signin.GoogleSignInAccount#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionController.java From PGSGP with MIT License | 8 votes |
public Pair<Boolean, String> isConnected() { GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity); String accId = ""; if (googleSignInAccount != null && googleSignInAccount.getId() != null) { accId = googleSignInAccount.getId(); } return new Pair<>(GoogleSignIn.hasPermissions(googleSignInAccount, signInOptions.getScopeArray()), accId); }
Example 2
Source File: SignInController.java From PGSGP with MIT License | 6 votes |
public void onSignInActivityResult(GoogleSignInResult googleSignInResult) { if (googleSignInResult != null && googleSignInResult.isSuccess()) { GoogleSignInAccount googleSignInAccount = googleSignInResult.getSignInAccount(); String accId = ""; if (googleSignInAccount != null && googleSignInAccount.getId() != null) { accId = googleSignInAccount.getId(); } enablePopUps(); godotCallbacksUtils.invokeGodotCallback(GodotCallbacksUtils.SIGNIN_SUCCESSFUL, new Object[]{accId}); } else { int statusCode = Integer.MIN_VALUE; if (googleSignInResult != null && googleSignInResult.getStatus() != null){ statusCode = googleSignInResult.getStatus().getStatusCode(); } godotCallbacksUtils.invokeGodotCallback(GodotCallbacksUtils.SIGNIN_FAILED, new Object[]{statusCode}); } }
Example 3
Source File: Utils.java From PretendYoureXyzzyAndroid with GNU General Public License v3.0 | 6 votes |
@NonNull public static String getAccountName(@NonNull GoogleSignInAccount account) { String name = account.getDisplayName(); if (name == null || name.isEmpty()) { name = account.getGivenName(); if (name == null || name.isEmpty()) { name = account.getEmail(); if (name == null || name.isEmpty()) { name = account.getId(); if (name == null || name.isEmpty()) name = "<unknown>"; } } } return name; }
Example 4
Source File: GoogleLoginHiddenActivity.java From SocialLoginManager with Apache License 2.0 | 6 votes |
private void handleSignInResult(GoogleSignInResult result) { if (result.isSuccess()) { GoogleSignInAccount acct = result.getSignInAccount(); SocialUser user = new SocialUser(); user.userId = acct.getId(); user.accessToken = acct.getIdToken(); user.photoUrl = acct.getPhotoUrl() != null ? acct.getPhotoUrl().toString() : ""; SocialUser.Profile profile = new SocialUser.Profile(); profile.email = acct.getEmail(); profile.name = acct.getDisplayName(); user.profile = profile; SocialLoginManager.getInstance(this).onLoginSuccess(user); } else { Throwable throwable = new Throwable(result.getStatus().getStatusMessage()); SocialLoginManager.getInstance(this).onLoginError(throwable); } finish(); }
Example 5
Source File: BaseNearbyActivity.java From friendspell with Apache License 2.0 | 6 votes |
private NearbyPerson getMe() { GoogleSignInAccount me = googleApiClientBridge.getCurrentAccount(); if (me == null) { return null; } String displayName = me.getDisplayName(); if (displayName == null) { displayName = "null"; } Uri imageUri = googleApiClientBridge.getCurrentAccount().getPhotoUrl(); String imageUrl = imageUri != null ? imageUri.toString() : null; return new NearbyPerson( me.getId(), displayName.substring(0, 1), displayName, imageUrl); }
Example 6
Source File: AndroidGoogleAccount.java From QtAndroidTools with MIT License | 5 votes |
private boolean loadSignedInAccountInfo(final GoogleSignInAccount SignedInAccount) { if(SignedInAccount != null) { AccountInfo SignedInAccountInfo = new AccountInfo(); final Uri PhotoUrl = SignedInAccount.getPhotoUrl(); SignedInAccountInfo.id = SignedInAccount.getId(); SignedInAccountInfo.displayName = SignedInAccount.getDisplayName(); SignedInAccountInfo.email = SignedInAccount.getEmail(); SignedInAccountInfo.familyName = SignedInAccount.getFamilyName(); SignedInAccountInfo.givenName = SignedInAccount.getGivenName(); if(PhotoUrl != null) { DownloadAccountPhotoTask DownloadAccountPhoto = new DownloadAccountPhotoTask(SignedInAccountInfo); DownloadAccountPhoto.execute(PhotoUrl.toString()); } else { SignedInAccountInfo.photo = null; updateSignedInAccountInfo(SignedInAccountInfo); } return true; } return false; }
Example 7
Source File: RxAccount.java From RxSocialAuth with Apache License 2.0 | 5 votes |
public RxAccount(GoogleSignInAccount gsa) { this.id = gsa.getId(); this.accessToken = gsa.getIdToken(); this.email = gsa.getEmail(); this.firstname = gsa.getGivenName(); this.lastname = gsa.getFamilyName(); this.displayName = gsa.getDisplayName(); this.photoUri = gsa.getPhotoUrl(); this.provider = IdentityProviders.GOOGLE; }
Example 8
Source File: HomeActivity.java From Movie-Check with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); if (result.isSuccess()) { GoogleSignInAccount googleSignInAccount = result.getSignInAccount(); User user = new User(googleSignInAccount.getId(), googleSignInAccount.getDisplayName(), googleSignInAccount.getEmail(), googleSignInAccount.getPhotoUrl().toString()); presenter.login(user); } } }