Google 계정으로 사용자가 로그인한 후 Google 로그인을 구성한 경우
DEFAULT_SIGN_IN
매개변수 또는 requestProfile
메서드를 사용하면
사용자의 기본 프로필 정보에 액세스 Google 로그인을 구성한 경우
requestEmail
메서드를 사용하면 이메일 주소를 가져올 수도 있습니다.
시작하기 전에
로그인한 사용자의 프로필 정보 가져오기
GoogleSignIn.getLastSignedInAccount
메서드를 사용하여 프로필을 요청합니다.
현재 로그인한 사용자의 정보
GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
String personName = acct.getDisplayName();
String personGivenName = acct.getGivenName();
String personFamilyName = acct.getFamilyName();
String personEmail = acct.getEmail();
String personId = acct.getId();
Uri personPhoto = acct.getPhotoUrl();
}
사용할 수 있는 추가 프로필 데이터에 대한 내용은 다음을 참고하세요.
GoogleSignInAccount
범위에 따라 프로필 필드는 null
가 될 수 있습니다.
사용자 프로필에 포함된 정보