Srikanth Pai
Srikanth Pai

Reputation: 926

To Post on friend's wall using feed dialog in sdk 3.5

I am trying to post on the wall or send a private message to a friend.. I am using the latest SDK 3.5. I read that we should use the feed dialog to perform it.

my Code

private void publishFeedDialog() {
    try{
        Bundle params = new Bundle();
        params.putString("name", "Facebook SDK for Android");//title 
        params.putString("caption", "Build great social apps and get more installs.");//caption 
        params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");

        WebDialog feedDialog = (
                new WebDialog.FeedDialogBuilder(InviteParticipantsActivity.this,
                    Session.getActiveSession(),
                    params))
                .setOnCompleteListener(null)
                .build();
            feedDialog.show();
}
catch(Exception e){
    e.printStackTrace();
}
}

This code will post it on my wall but I am looking to post it on a friends wall or send a message.

I have all the details such as the name and id of the target user.

Upvotes: 3

Views: 3203

Answers (2)

Madhu
Madhu

Reputation: 298

Use below code. Use setTo() method where you have to pass the ID of the friend as parameter .

 WebDialog feedDialog =( new WebDialog.FeedDialogBuilder(getApplicationContext(), Session.getActiveSession(), null).setTo(ID)).setOnCompleteListener(null).build()
                feedDialog.show();

Upvotes: -1

Srikanth Pai
Srikanth Pai

Reputation: 926

params.putString("to", "TARGET Facebook USER ID");

To post on your friends wall Add the parameter "to"

Upvotes: 3

Related Questions