【发布时间】:2018-11-21 05:59:42
【问题描述】:
Google Plus API 已弃用。我如何从请求范围中获取性别和出生日期。以下是我的代码:
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken("xxxxxxxxx.apps.googleusercontent.com")
.requestEmail()
.requestProfile()
.requestScopes(Scope(Scopes.PROFILE))
.build()
val mGoogleSignInClient = GoogleSignIn.getClient(this, gso)
从这个登录选项我想要谷歌用户的性别和出生日期。
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
callbackManager.onActivityResult(requestCode, resultCode, data)
if (requestCode == RC_SIGN_IN) {
val result = GoogleSignIn.getSignedInAccountFromIntent(data)
try {
val account = result.getResult(ApiException::class.java)
//Here I want gender and date of birth from google sign in option
} catch (e: ApiException) {
e.printStackTrace()
}
}
}
【问题讨论】:
标签: android kotlin google-signin