Skip to content

Get FB Friends List ​

Method ​

java
public static void facebookGetFriList(Context context, GetFBFriendsMode getFriendMode, FacebookGetInvitableFriListener listener )

Parameter Descriptioin ​

ParameterDescriptioin
contextContext object
getFriendModeGetFBFriendsMode is an enumeration class that contains GETINVIALBEFRIENDS and GETFRIENDS. Passing GETINVIALBEFRIEDNS will get a list of friends who have not played the game, and the GETFRIENDS will get the list of friends who have played the game.
facebookGetInvitableFriListenerGet FB friends list listener.

Callback Description ​

GamedreamerFacebookGetInvitableFrilistener.onResult(List<GDFBFriend> friendList) callback method description:

  • This method is called after successfully getting a FB friend list. The parameter “friendList “is an inviteable FB friends list data, and the game displays a Friends List Page acrroding with the data for the player to select the friend who wants to invite. If the number of friends can be invited is 0, then friendList.size() = 0. The attributes defined by the GDFBFriend class are as following image. Call the getter() method to get friends related attributes.
  • GDFBFriend類

Example Code ​

java
GDSDK.facebookGetFriList(TestFbActivity.this, GDGetFBFriendsMode.GET_INVIALBE_FRIENDS, new GamedreamerFacebookGetInvitableFriListener() {

	@Override
	public void onResult(List<GDFBFriend> list) {
//	     mGDFBFriends=list;
	     System.out.println("facebookGetFriList list:"+list);
	     if (list.size()>0) {
	          mItemDataSourseList=new ArrayList<ItemDataSourse>();
	          for (int i = 0; i < list.size(); i++) {
	                   GDFBFriend gdfbFriend = list.get(i);
	                   ItemDataSourse itemDataSourse = new ItemDataSourse();
	                   itemDataSourse.setGDFBFriends(gdfbFriend);
	                   itemDataSourse.setChecked(false);
	                   mItemDataSourseList.add(itemDataSourse);
	          }
	          mAdapter = new TestFbAdapter(TestFbActivity.this, mItemDataSourseList);
	          hy_fb_fri_listview.setAdapter(mAdapter);
	     }
	}
});