Skip to content

Send FB Invitation Message ​

Method ​

java
public void gamedreamerFBInviteFriends(Context context, GDFacebookInviteFrisContent facebookInviteFrisContent, FacebookInviteFriendsListener facebookInviteFriendsListener)

Parameter Descriptioin ​

ParameterDescriptioin
contextContext object.
facebookInviteFrisContentGDFacebookInviteFrisContent object. The attributes defined by the this class are as following iamge. Call the getter() method to get related attributes. Where invitedFriList is the player's list of friends that you want to invite. If you use the friend list page provided by FBSDK, the parameter invitedFriList is not passed.
facebookInviteFriendsListenerSend FB invitation message listener.
  • The attributes defined by the facebookInviteFrisContent class are as following image:GDFacebookInviteFrisContent類

Callback Description ​

GamedreamerFacebookInviteFriendsListener.onFaceBookInviteFriendResult(GDFaceBookInviteFrisResult gdFaceBookInviteFrisResult) callback method description:

  • Send FB invitation message callback method.
  • The class GDFaceBookInviteFrisResult contains attributes as follows, through the attributes getter() method to obtain data:
  • GDFacebookInviteFrisResult
  • The attribute code is shown in the following table:
codeDescription
200Invitation success.
201Invitation success, there is a repeated invitation.
202The invitation was successful and the local cache failed.
300FB invitation failed, returned error with exception information.
301FB invitation failed, the reason is unknown
302The player canceled the invitation.
4xxParameter is null.

Example Code ​

java
List<GDFBFriend> gdfbFriendList=new ArrayList<GDFBFriend>();
if (mAdapter != null) {
HashMap<Integer, Boolean> checkedStateMap = mAdapter.checkedStateMap;
	for (int i = 0; i < mItemDataSourseList.size(); i++) {
	    if (checkedStateMap.get(i) != null) {
	          gdfbFriendList.add(mItemDataSourseList.get(i).getGDFBFriends());
	    }
	}
}

GDFacebookInviteFrisContent facebookInviteFrisContent = new GDFacebookInviteFrisContent();
facebookInviteFrisContent.setTitle("title");
facebookInviteFrisContent.setMessage("message");
facebookInviteFrisContent.setInvitedFriList(gdfbFriendList);
GDSDK.gamederamerFacebookInviteWithFriends(TestFbActivity.this, facebookInviteFrisContent, new GamedreamerFacebookInviteFriendsListener() {
	@Override
	public void onFaceBookInviteFriendResult(GDFaceBookInviteFrisResult gdFaceBookInviteFrisResult) {
	    Toast.makeText(getApplicationContext(), gdFaceBookInviteFrisResult.getMessage(),Toast.LENGTH_SHORT).show();
	}
});