I am using Faccebook android API (com.facebook.android) to post the messages on facebook.
Facebook mFacebook = new Facebook(Constants.APP_ID);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle parameters = new Bundle();
parameters.putString("message", "this is a test post");// the message to post to the wall
mFacebook.dialog(this, "stream.publish", parameters, new SampleDialogListener());
Everything is working fine. I'm able to login and post the message, but after login, it is displaying a intermediate dialog, "Publish story" with a text box with my post msg, "this is a test post" that is editable by the user, but i want to post the messages immediately after login without having this intermediate post screen.
Can anybody help me how to achieve this.
Thanks,
nehatha
This is how you do it:
Bundle bundle = new Bundle(3);
bundle.putString("message", "Hello!");
mFacebook.request("me/feed", bundle, "POST");
Related
Anyone know the way to share the android application market link using facebook by sent request to Facebook friends.
If any giant helpful me a lot.
Thanks in advance.
Look at https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed page. In Publishing section click on Android SDK tab and you can see this snippet:
Bundle params = new Bundle();
params.putString("message", "This is a test message");
/* make the API call */
new Request(
session,
"/me/feed",
params,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
I think you can use "link" field (with combination of name, caption, description or message).
Bundle params = new Bundle();
params.putString("name", "Name of your app");
params.putString("message", "Your message");
params.putString("link", "https://play.google.com/store/apps/details?id=<your_package_name>");
And in addition you can link stories generated by your app with your app's Google Play listing. It's called "Deep Linking": https://developers.facebook.com/docs/applinks/android
Now, I know that it's common question, but since "message" parameter is not valid, I wonder how to post just message to my facebook wall?
I use this:
public void postOnWall(Facebook mFacebook) {
try{
Bundle parameters = new Bundle();
parameters.putString("caption", "Caption");
parameters.putString("description", "Description");
mFacebook.dialog(this, "feed", params, new PostDialogListener());
}
catch(Exception e){}
}
I always get empty form without any title or content. I tried all params from facebook sdk docs but still no results.
UPD: when I say empty I mean this:
Why is the message parameter invalid? If you want to only post a message on your wall its should simply be just a matter of doing the following:
Bundle params = new Bundle();
params.putString("message", "test message on my wall");
mAsyncRunner.request("feed", params, "POST", new PostDialogListener(), null);
Please see below link of Stack overflow's answer for how to integrate facebook into your android application and if u have any query regarding that then tell me.
Post status on Facebook
I am integrating Facebook in my app and I could do with ease,but I am facing a problem when I am trying to post a message with hyperlink on the wall, when I am trying to do this I am getting Missing message or attachment OauthException code 100, I was able to post a message without hyperlink. This is the code which I am using for posting on wall:
JSONObject attachment = new JSONObject();
attachment.put("message", "Messages");
attachment.put("name", "click");
attachment.put("href", "http://www.facebook.com");
Bundle parameters = new Bundle();
parameters.putString("attachment",attachment.toString());
response = mFacebook.request("me/feed", parameters,"POST");`
Can any one tell me where I am going wrong?
Thank you.
Try doing something like:
Bundle parameters = new Bundle();
parameters.putString("message", "Messages");
parameters.putString("name", "click");
parameters.putString("link", "http://www.facebook.com");
response = mFacebook.request("me/feed", parameters, "POST");
I am developing an application which is able to let a user send a message to a friend on facebook. I have looked at Facebook API, Hackbook folder. I used the following code, but it did not work. It seems to ask me to implement a new dialog for it.
Bundle params = new Bundle();
params.putString("caption", app_name);
params.putString("picture", picture);
dialog(MyClass.this, "send", params, new UpdateStatusListener());
Any help is very appreciated !
Check this Snippet for Posting on Friend's wall :
try{
parameters.putString("message", "Text is lame. Listen up:");
parameters.putString("target_id", "XXXXX"); // target Id in which you need to Post
parameters.putString("method", "stream.publish");
String response = authenticatedFacebook.request(parameters);
Log.v("response", response);
}
catch(Exception e){}
i am doing a sample Facebook application in that i post a image file to a particular friend in my friends list, if any one having the solution...
Here is the code..i put the stream.publish method inside the request function..it works well..
protected void postToWall(String temp2) {
Bundle params = new Bundle();
params.putString("message", _messageInput.getText().toString()"some text Here);
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/");
**mAsyncRunner.request(((temp2 == null) ? "me" : temp2) + "/feed",
params, "POST", new WallPostRequestListener(),stream.publish);**
}