5

I am developing an Android application in which the user logs in using its facebook id. I can get all the information about the user and i even get its friends list with following methods

facebookClient.request("me")

facebookClient.request("me/friends")

My query is that i want to give flexibility to the user to invite its facebook friends. I dont know what extra stuff is to be done here. Any help will be appreciated.

Kara
  • 6,115
  • 16
  • 50
  • 57
abhishek
  • 1,434
  • 7
  • 39
  • 71
  • Your question is too general/open. Please provide in more details which part of the functionality you are having trouble with (code snippets would help too). – Kon May 05 '11 at 11:23
  • Thanks for commenting Kon. As i mentioned i am developing facebook application and using facebook sdk for android for the user to log in to my app. And as the user logs in i get the token and with that token i can get all information about the user which is present on facebook. I can even get the friends list but now i want to allow the user to post message on its friends walls. More like an invitation to my application. How can i get this working in android. – abhishek May 05 '11 at 11:36
  • Oh, so just the actual wall post part.. gotcha.. – Kon May 05 '11 at 13:09

2 Answers2

9

Check out:

How to post on facebook wall using Facebook android SDK, without opening dialog box

and

How to post message on facebook wall using Facebook android SDK integrate android app

Here's a small example that will post to a friend's wall (or if userId is null then to the currently logged in user's wall):

protected void postToWall(String userId)
{
    Bundle params = new Bundle();
    params.putString("message", _messageInput.getText().toString());
    params.putString("caption", "{*actor*} just posted a secret message.");
    params.putString("description", "A secret message is waiting for you.  Click the link to decode it.");
    params.putString("name", "A Secret Message For You");
    params.putString("picture", "http://www.kxminteractive.com/Content/images/app_logos/secretMessage.png");
    params.putString("link", "http://www.kxminteractive.com/decrypt/" + _lookupKey);        

    asyncRunner.request(((userId == null) ? "me" : userId) + "/feed", params, "POST", new WallPostRequestListener());       
}
Community
  • 1
  • 1
Kon
  • 27,113
  • 11
  • 60
  • 86
  • Great start... +.5 as is. I'd give it a full +1 if you'd also provide the code on how to set up the asyncRunner. – PeteH Jun 26 '13 at 14:43
  • @Kon This is not working now as graph api is not allowed to post on friends wall.Will you please show me how to do this? – Jithin Sunny Mar 04 '14 at 07:55
  • Sunny, this was the answer three years ago. I haven't done much Facebook dev since then. – Kon Mar 04 '14 at 12:26
  • 1
    is it possible to post massage on friends wall...? –  Jun 16 '14 at 09:43
  • same question from my side, anyone knows if its currently possible at all? :) – cV2 Aug 06 '14 at 19:05
0

use this to send message on friends wall of id(uid):

Bundle params = new Bundle();                           
params.putString("message", "hello ...");
Utility.mAsyncRunner.request(uid+"/feed", params, "POST", new FriendRequestListener(), null);
j0k
  • 22,600
  • 28
  • 79
  • 90
Nishant
  • 93
  • 4