【发布时间】:2013-07-04 04:53:19
【问题描述】:
我已经在 android 中完成了 Google plus 集成。在我的应用程序中,它使用谷歌帐户登录。
它显示在屏幕下方! Login screen
在我登录我的谷歌帐户并按照步骤操作后 1) 它要求应用程序使用 your circle 或 only me 然后我只选择我。 2)它登录并仅显示我的帐户名。我使用 loadPerson 方法获取人员详细信息...
@Override
public void onConnected(Bundle connectionHint)
{
mConnectionProgressDialog.dismiss();
String accountName = mPlusClient.getAccountName();
//mPlusClient.loadPeople(this, Person.Collection.VISIBLE);
Log.d("User", "Account Name = "+accountName);
Toast.makeText(GooglePlusActivity.this, "Welcome "+accountName, Toast.LENGTH_SHORT).show();
final String account = mPlusClient.getAccountName();
mPlusClient.loadPerson(this, "me");
}
onPersonload 函数...
@Override
public void onPersonLoaded(ConnectionResult status, Person person) {
// TODO Auto-generated method stub
if (status.getErrorCode() == ConnectionResult.SUCCESS) {
Log.d("GooglePlusActivity", "Display Name: " + person.getDisplayName());
Toast.makeText(this, "Display name:"+person.getDisplayName(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, "about me:"+person.getAboutMe(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, "id:"+person.getId(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Name:"+person.getName(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Birthdate:"+person.getBirthday(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Gender:"+person.getGender(), Toast.LENGTH_SHORT).show();
}
else
{
Log.d("Error", "Connection error::"+status.getErrorCode());
}
}
然后在选择应用程序用作只有me 但是选择“圆圈”时显示详细信息
是否有任何想法或示例代码可以获取详细信息。 以及如何从帐户中完全退出。所以它应该要求重新登录....
【问题讨论】:
-
请把代码贴出来好吗?
标签: android google-plus