谷歌Android加号按钮 [英] Android Google plus sign in button
问题描述
继谷歌号按钮,我实现了它在我的Android设备上
Following Google Sign Button, I implemented it on my android device.
单击它显示了一个弹出征求您的同意按钮时: 了解您在谷歌谁。
When clicking the button it shows you a popup asking your permission: Know Who you are on Google.
现在是什么? 它看起来像这样给我什么。它不提供我access_token,或任何用户的数据。
Now what? It looks like this gives me nothing. It does not provide me access_token, or any user data.
这是什么好?
*请不要告诉我怎么去access_token这不是个问题是关于
*Please do not tell me how to get access_token this is not what the question is about
推荐答案
您必须实现ConnectionCallbacks。而在onConnected(),你就可以开始得到你想要从谷歌加帐户的用户数据。下面是我的示例code的功能:
You have to implement ConnectionCallbacks. And in onConnected(), you can start to get user data you want from the google plus account. Here's my sample code for the function:
@Override
public void onConnected(Bundle connectionHint) {
// We've resolved any connection errors.
mConnectionProgressDialog.dismiss();
String accountName = mPlusClient.getAccountName();
Person p = mPlusClient.getCurrentPerson();
String displayName = p.getDisplayName();
google_text.setText(String.format("email:%s\ndisplay name:%s",accountName, displayName));
}
您可以看到谷歌的链接更多的人数据:的人
You can see more Person data in Google's link: Person
这篇关于谷歌Android加号按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!