Reputation: 134
It seems that the native Request Dialog shows a list where you can choose the friends you want to invite. I'm trying to do something where the user can just press a button to invite a specific person, say a girlfriend, or a family member.
Is this possible using the native Android SDK?
Update: Okay, this was voted to be closed so I'm updating. There wasn't anything said in the Facebook tutorials that you can send a Facebook Request to a specific person, which I was trying to do.
I've tried the following but it displays a friend selector with all of the user's friends:
Bundle params = new Bundle();
params.putString("message", "Invite message here");
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(getActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
// Some onComplete callback here
}
}).build();
requestsDialog.show();
And by adding .setTo(id)
where id is the UID of the user to invite before .build()
, the dialog is modified to send to just the indicated user. The code looks like:
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(getActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
// Some onComplete callback here
}
}).setTo("SOME_FACEBOOK_ID_HERE").build();
requestsDialog.show();
Upvotes: 1
Views: 1155
Reputation: 134
Actually, I just read the documentation of the Request Dialog again. And it can be configured to send to a specific person by doing .setTo(String id)
.
Thanks for the reply though. :)
Upvotes: 1