如何在成功后从Google登录按钮检索数据?
问题描述:
我已经创建了Google登录按钮,通过Google帐户访问我的应用。如何在成功后从Google登录按钮检索数据?
我没有想过如何检索谷歌帐户的信息,并将其存储到我的sqlitedB的应用程序。
所以,任何人都可以有一个建议,请让我知道。
感谢您的提示。
答
使用GoogleSignInResult.getSignInAccount方法来请求当前登录用户的配置文件信息。
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
GoogleSignInAccount acct = result.getSignInAccount();
String personName = acct.getDisplayName();
String personEmail = acct.getEmail();
String personId = acct.getId();
Uri personPhoto = acct.getPhotoUrl();
非常感谢你+ sasikumar – user2675040