这可以使用 google plus api 来完成。虽然您无法在一次请求中获得每个朋友的完整个人资料信息,但它至少会为您提供以下信息
要进一步获取个人资料信息,您必须分别获取每个朋友的个人资料信息。
下面给出的是获取好友列表的代码
mPlusClient.loadPeople(new OnPeopleLoadedListener()
{
@Override
public void onPeopleLoaded(ConnectionResult status, PersonBuffer personBuffer, String nextPageToken)
{
if ( ConnectionResult.SUCCESS == status.getErrorCode() )
{
Log.v(TAG, "Fetched the list of friends");
for ( Person p : personBuffer )
{
Log.v(TAG, p.getDisplayName());
}
}
}
}, Person.Collection.VISIBLE); // VISIBLE=0
}
回调中的“for-loop”用于迭代每个“Person”对象。
现在要获取更多个人资料信息,您可以使用以下代码片段
mPlusClient.loadPerson(new OnPersonLoadedListener()
{
@Override
public void onPersonLoaded(ConnectionResult status, Person person)
{
if ( ConnectionResult.SUCCESS == status.getErrorCode())
{
Log.v(TAG, person.toString());
}
}
}, "me"); // Instead of "me" use id of the user whose profile information you are willing to get.
为了进一步清晰,请查看此链接https://developers.google.com/+/mobile/android/people