问题描述
我无法使用GoogleFit检索Google登录用户的个人资料信息
我正在使用此https://developers.google.com/identity/sign-in/android/people#retrieve_profile_information_for_a_signed-in_user
(link)
我的代码:(获取信息,返回变量personEmail,即尝试在日志中显示,测试中的日志未显示在调试中)
public void getGoogleInfo() {
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
if (account != null) {
String personName = account.getDisplayName();
String personGivenName = account.getGivenName();
String personFamilyName = account.getFamilyName();
String personEmail = account.getEmail();
String personId = account.getId();
}
}
public String returnGoogleInfo() {
return this.personEmail;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_read_data) {
getGoogleInfo();
String val = returnGoogleInfo();
Log.d("val",val);
return true;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)