3

私はAndroidでGoogleと統合を行いました。私のアプリケーションでは、Googleアカウントでログインします。

画面の下に表示されます! ログイン画面

そして、Googleアカウントにログインして手順に従います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");

}

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());
    }

}

次に、アプリケーションの使用を自分のみとして選択すると何も表示されませんが、「あなたのサークル」を選択すると詳細が表示されます

詳細を取得するためのアイデアやサンプル コードはありますか。アカウントから完全にサインアウトする方法.したがって、新しいログインを要求する必要があります....

4

1 に答える 1