Facebook SDK Graph API posting message on the wall - android

My Facebook app's Status and Review feedback suggests not to pre-fill text while posting on wall. But I can found the use of message param in the Facebook Graph API documentation Graph API Publishing section.
Bundle params = new Bundle();
params.putString("message", "This is a test message");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/feed",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
I have verified it and it works fine. Is it allowed as per updated Facebook policies ?

The message must be 100% user generated, so if you present an (EMPTY!) input field where the user can enter the message before you do the API call, it´s fine. Prefilling means that you prefill the message or the input field, which is not allowed.
https://developers.facebook.com/docs/apps/review/prefill

Related

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 application link share using facebook request

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

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