get multiple pictures ID from page's post (Facebook GraphAPI - Android) - android

I am trying to get the posts from a page including all the pics related to the post.
I am able to get one picture from the post using object_id, but I need the other photos as well.
object_id returns only one Id which is the first photo's ID.
Please help.
GraphRequest greq =
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/posts",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
JSONArray data = null;
}
}
);
Bundle params = new Bundle();
params.putBoolean("redirect",false);
params.putString("fields", "object_id");
greq.setParameters(params);
greq.executeAsync();

The data should be in the attachments field. In the subattachments sub-field specifically.
You should test this in the Graph API Explorer to see the API response and update your Android implementation based on that.

Related

How to use parameter referenced_sticker_id in Facebook graph api me/videos..?

Bundle params = new Bundle();
params.put("file_url","video_url")
params.put("title","post video")
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/videos",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
In that particular video posting graph api there is one parameter as per documentation please have a look.
There is one param referenced_sticker_id which means "Sticker id of the sticker in the post"
but how can i use this parm by which i can share my sticker with video i try it by using image url but it doesn't work.It needs Numeric string or integer value foe sticker.

Facebook graph API android add feelings in post

I am using Facebook android SDK (V4) to post a message on Facebook using "me/feed" graph API.
Bundle params = new Bundle();
params.putString("message", message);
new GraphRequest(
token,
"me/feed",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
//Handle response
}
}
).executeAsync();
This is working fine.
Now I want to add feeling/Activity in my post.
I have search on Google but haven't found any solution on that.
Does anybody know of a way?
Thanks in advance.

Getting Facebook photos in android from Graph API URL

On android I'm using Facebook SDK 4.0. I want to get all photos of a user logged in via Facebook login.
I have this URL
https://graph.facebook.com/FACEBOOK_ID/albums?access_token=TOKEN
How do I parse and generate images to be viewed in a ListView ?
set Bundle for extra parameters like crate a bundle for required parameters ex:
Bundle parameters = new Bundle();
parameters.putString("fields", "id, picture");
Then set it to GraphRequest.
you have to used below code to get all photos of user.
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{user-id}/photos",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();

Android Facebook SDK: How to retrieve Mutual friends Graph API response

I implemented this code from the Facebook SDK to get mutual friends.
Bundle params = new Bundle();
params.putString("fields", "context.fields(mutual_friends)");
// make the API call
new Request(
session,
"/{user-id}",
params,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
Log.d("results", response.toString());
}
}
).executeAsync();
How do i read the Response object and retrieve the total count and the list of mutual friends? I have successfully gotten the result in the log.
Thanks.
Booth people need autorize your friend_list_permission to you see the users in common. If not you need use all_mutual friends, but you just can run this in server, no working in clients. look documentation in all_mutual_friends.
I explain this post here.
https://stackoverflow.com/a/34663235/3516549

android app add functionality to like fb page and comment on fb posts

Hello this is the first time I am integrating facebook in any of my android applications
I need to implement functionality to like a fp page/post and comment on fb page/post ,,,!!
i have downloaded the fb sdk for android and played around with it how ever i am still not clear as to what to i need to do and how to approach the requirement
What i need is when the user clicks a button in my app it automatically likes a fb post
and it submits text from edit text as a comment to as fb post ,,!!
Can some one tell how to go about this
To "like" a post:
Something like:
Facebook mFacebook = new Facebook();
mFacebook.request(THE_POST_ID + "/likes", parameters, "POST");
To "comment" on a post:
Bundle parameters = new Bundle();
parameters.putString("message", edtComment.getText().toString());
mFacebook.request(THE_POST_ID + "/comments", parameters, "POST");
To like a post
Request likeRequest = new Request(Session.getActiveSession(), postId + "/likes", null, HttpMethod.POST, new Request.Callback() {
#Override
public void onCompleted(Response response) {
this.like.setText("liked");
this.like.setEnabled(false);
CommentAdapter.this.like.setBackgroundResource(R.drawable.disabled_like);
this.getLikesCount();
}
});
Request.executeBatchAsync(likeRequest);

Categories

Resources