We have a problem creating photo album in facebook using android and graph API. We already have been able to upload photos to facebook using Graph API. We are using following for uploading a photo to facebook.
Bundle params = new Bundle();
params.putString("method", "photos.upload");
params.putString("title", uploadFile.getName());
params.putString("privacy", "{'value':'EVERYONE'}");
facebook.request("https://api.facebook.com/restserver.php?method=photos.upload",params,"POST");
Please let us know if anybody aware of. We have searched a
I have found the working solution for the above problem.
Bundle params = new Bundle();
params.putString("name", albumName);
String response = mFacebook.request("https://graph.facebook.com/me/albums",params,"POST");
String albumId=Util.parseJson(response).getString("id");
Above code will help create a new photo album with the albumName and return the album id generated by facebook.
Related
I am using facebook sdk in Android. I can take friendlist information by using:
Bundle params = new Bundle();
params.putString("fields", "name, picture,location");
Utility.mAsyncRunner.request("me/friends", params,new FriendsRequestListener());
How can I get page posts like statuses, image, photos, videos etc. ?
I want to share a link in my application.I didnt find any api for sharing link in graph api.
What is the difference between sharing and posting in facebook?How can I perform sharing ?
Thanks in advance
You can post to wall on facebook using this code:
Bundle parameters = new Bundle();
parameters.putString("message","YOUR_MESSAGE");
parameters.putString("link", "ANY_LINK");
String response = facebook.request("me/feed", parameters,
"POST");
Also to upload an image, you can use this code:
Bundle parameters = new Bundle();
parameters.putString("message","YOUR_MESSAGE");
parameters.putString("caption","ANY_CAPTION");
parameters.putByteArray("picture", "IMAGE_LINK");
String response = facebook.request("me/photos", parameters,
"POST");
Hope it will help you.
How can I send the place params while uploading a photo from android to facebook.
Bundle params = new Bundle();
params.putByteArray("photo", byteArray);
params.putString("caption", "FbAPIs Sample App photo upload");
//params.putString("place", "Banglore");
//params.putString("location", "banglore");
Utility.mAsyncRunner.request("me/photos", params, "POST",
new PhotoUploadListener(), null);
Add the place to the params, much like you did the caption.
params.putString("place","someLocation");
You're almost there. Instead of using "Bangalore" for example, pass in the Facebook place ID.
Ex:
params.putString("place", "106377336067638");
For reference, see: https://developers.facebook.com/docs/reference/api/user/#photos
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!
I have been searching for this all day and just when I find something, I find it is not what I am looking for. In short, I am upgrading my app to use the Facebook graph API for Android and the documentation is horrible. All I want is to upload a picture into the default album for the app. I have the following code:
Facebook f = new Facebook(APP_ID);
Bundle parameters = new Bundle();
parameters.putString("message", caption);
parameters.putByteArray("picture", data);
f.dialog(mContext, "publish.stream", parameters, this); //TODO: This is wrong
I think the publish.stream is what is the problem because the exception that I got when I did my "this doesn't have a prayer" test was a malformedURLException.
Can someone tell me if I am even on the right track?
Thanks,
Jake