hey I'm using this code technique to post on my fb wall
// parameters.putString("description", "Muslim Baby Names");
parameters.putString("picture","http://img208.imageshack.us/img208/4834/pic1qu.png");
it does make a post but picture odes not get posted.
Kindly tell me how should I do it
Check out our example app that uses the Android SDK, Hackbook. Here is the relevant code that uploads a photo to a user's wall from a remote URL.
For your example, this is how you would do it:
Bundle params = new Bundle();
params.putString("url", "http://img208.imageshack.us/img208/4834/pic1qu.png");
params.putString("caption", "Muslim Baby Names");
mAsyncRunner.request("me/photos", params, "POST");
Let me know if that helps!
Related
I am posting a photo to FB using the new FB Android SDK 3.0. I am now looking for a way to set some more parameters than just the image itself and a simple text. I tried tons of different parameters, but non of them seem to do something.
What i would like to do is to add a link, an icon and, if somehow possible, a custom link item next to the Like and Comment links.
Here is an example of the icon and the custom link item from twitter:
And this is the code that I am currently using:
byte[] data = get binary image data;
Bundle postParams = new Bundle();
postParams.putString("name", "Image text");
postParams.putByteArray("picture", data);
// All these parameters do nothing...
postParams.putString("icon", "http://www.myimage.com/image.png");
postParams.putString("message", "XXX");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
Request request = new Request(Session.getActiveSession(), "me/photos", postParams, HttpMethod.POST);
Response r = request.executeAndWait();
The post looks like this:
1. Adding the icon
You can manage icons from your app's dashboard: https://developers.facebook.com/apps/APP_ID/appdetails
2. Adding an action link
What you can a "custom link" is in fact an "action".
The "action" you've seen on the Twitter's post has been done using the actions array from the Post table:
A list of available actions on the post (including commenting, liking,
and an optional app-specified action)
So, your only choice if you really want to add this action near Like ยท Comment is to create a Post into the Feed and not a Photo.
Here is an a priori working code:
postParams.putString("message", "XXX");
postParams.putString("caption", "developers.facebook.com");
postParams.putString("description", "A tool to help you learn and browse the Facebook Graph API.");
postParams.putString("actions", "[{
'name':'Test a simple Graph API call!',
'link':'https://developers.facebook.com/tools/explorer?method=GET&path=me'
/* ^ This link must direct to the application's connect or canvas URL.
You'll get an error otherwise. */
}]"
);
postParams.putString("type", "photo");
postParams.putString("link", "https://developers.facebook.com/tools/explorer/");
postParams.putString("picture", "http://blog.programmableweb.com/wp-content/ishot-44.png");
Request request = new Request(Session.getActiveSession(), "me/feed", postParams, HttpMethod.POST);
3. Test in the Graph API Explorer
4. Timeline preview
I'm using Facebook's latest SDK for Android.
Is it possible to post a status with BOTH place AND picture?
My bundle looks like this:
Bundle postParams = new Bundle();
postParams.putString("message", "Hi there!!");
postParams.putString("picture", "http://www.peleozen.net/pics/2_bus_face_logo.jpg");
postParams.putString("place", "204519339582365");
When I make the request, it results in a status with only the picture.
Making the request without a picture results in a checkin
So...is it possible to do both?
You can post to the /me/photos endpoint, so in a sense you're posting a photo, adding a location to it and the caption is the message. So as an example, if using the latest SDK, you could take a look at the HelloFacebookSample and make the following changes to the postPhoto method to try this out:
....
Bundle params = request.getParameters();
params.putString("message", "Hi there!!");
params.putString("place", "166793820034304");
request.setParameters(params);
Request.executeBatchAsync(request);
....
For reference, see: https://developers.facebook.com/docs/reference/api/user/#photos
I am using following code to post on a user's wall.
Bundle params = new Bundle();
params.putString("message", facebookMessage);
params.putString("link", ComLabelConstants.FACEBOOK_LINK);
params.putString("name", linkname);
params.putString("picture", "http://some link");
params.putString("caption", ComLabelConstants.FACEBOOK_LINK_CAPTION);
params.putString("description", "This is description");
// displaying facebook dialogs
mFacebook.dialog(FbookAlertBoxActivity.this, "feed", params,new SampleDialogListener(this, mAsyncRunner));
Now, I want to use my own image in drawable folder to post on user's wall and not from any link. Can we do that? anyone have solution for this.
You can't publish an image directly to a feed like you are asking - you can only pass a link to the image.
The only solution is to upload the image to a web server and then pass the URL of the image as the picture parameter.
I have a problem with Android Facebook API with writting to wall. I want to write there and add a link to another Facebook page. While other links work, Facebook links do not. Am I doing something wrong?
Normal links work:
// ...
Bundle parameters = new Bundle();
parameters.putString("message", "some message");
parameters.putString("link", "http://root.cz");
mFacebook.dialog(this, "stream.publish", parameters, new WallPostDialogListener());
// ...
Facebook links do not work:
// ...
Bundle parameters = new Bundle();
parameters.putString("message", "some message");
parameters.putString("link", "http://www.facebook.com/pages/Juky-MC/170228716347899");
mFacebook.dialog(this, "stream.publish", parameters, new WallPostDialogListener());
// ...
I get facebook window with "Sorry, something went wrong." "We're working on getting this fixed as soon as we can." error messages. Could anybody help me?
Thanks Jan
Have you tried removing the "www." at the "http://www.facebook.com/pages/Juky-MC/170228716347899" ?
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.
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());
}
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);