小编Nil*_*tel的帖子

如何在Android中集成google plus并获取个人资料信息?

我在android中完成了Google plus集成.在我的应用程序中,它使用谷歌帐户登录.

它在屏幕下方显示! 登录屏幕

并且在我登录到我的谷歌帐户后,我按照步骤1)它要求应用程序使用你的圈子只有我然后我只选择我.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");

}
Run Code Online (Sandbox Code Playgroud)

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(), …
Run Code Online (Sandbox Code Playgroud)

android google-plus

3
推荐指数
1
解决办法
3415
查看次数

标签 统计

android ×1

google-plus ×1