Which permissions I need to read Facebook App Users List - android

I need list of users which are using my Facebook App. So I am sending below Request.
new Request( session, "/me/friends", null, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
...});
Fo that which permissions I need to set in facebook app?
According to Graph API user_friends permission is required. But I cant find this permission anywhere in my app.
I was using "read_friendlists" permission but FB rejected it.
Reply from Facebook Review team :
read_friendlists
Android
It looks like you're trying to use read_friendlists for something it cannot do. This permission doesn't show you a list of a person's friends.
Read_friendlists gives access to the names of custom lists a person has created to organize their friends. It will not help you invite a person's friends to use your app. To learn more about how to invite friends to an app, please see our FAQs.
Please remove "read_friendlists" from your submission. Learn more here.

The user_friends permission is the right one to use. Keep in mind that /me/friends will only return the friends which are using the same app, not all friends.
See
Get facebook friends with Graph API v.2.0
https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-user_friends

Related

How to dev/test android app with Facebook sdk - while my app is not completed and not ready for review?

I'm developing android app which integrates Facebook SDK.
I need to login - OK, done this.
I need to retrieve friends birthdays - I know it is restricted. But can it be allowed after app review?
Or how to retrieve my friends list and birthday of each friend?
Thank you.
EDIT:
It looks strange to me that when using Facebook Graph API Explorer I do friend list request (e.g. graph.facebook.com/1012984682046884/friends) I'm getting full list of my friends. But when I do the same request from android application (see code below), I'm getting result: onCompleted resp[{"summary":{"total_count":228},"data":[]}]
Here is list of permission I'm requesting during login:loginButton.setReadPermissions(Arrays.asList("public_profile", "email", "user_birthday", "user_friends"));Also, have to tell that I am admin of my FB app, I use the same FB login.
GraphRequest request = GraphRequest.newGraphPathRequest(
act,
fbuid+"/friends",
new GraphRequest.Callback() {
#Override
public void onCompleted(GraphResponse response) {
// Insert your code here
Log.d("12x17","onCompleted resp["+response.getRawResponse()+"]");
}
});
request.executeAsync();
Or how to retrieve my friends list and birthday of each friend?
By making each friend log in to your app, and having them grant your app permission to access their friends, and their birthday.
No, there is no other way. You can not get friends that are not users of the same app, and you can not get a person’s birthday unless they personally grant permission.
If your app hasn't been approved yet by Facebook to retrieve that information through the Graph API you will only be able to retrieve the information for people on your friends list that are listed as Administrators, Developers, or Testers on your Facebook app developers page. Add a trusted friend or 2 to one of those categories and you should be able to retrieve that information

Get facebook albums and album images?

Hello Friends
I am trying to get facebook album of a user . Problem is that it is returning albums for the user who is created the facebook app or who is the admin of that application .
For rest of the users it is returning the empty array
new Request(session, "/me/albums", null, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
System.out.println("Responce "
+ response.getGraphObject());
}
}).executeAsync();
This work for me because i have create a facebook app and for the rest of the users it is not returning the data. Please let me know how to resolve this.
Thanks
Amit
When your application is in sandbox/development mode you can not perform any api call for other user. To test your for other user, add the user as a tester, developer or admin. See details here
Since you probably ask for the user_photos permission already (else it would not work for the admin), there are two possible problems why it does not work for other users:
Your App is in not set public. Go to the "Status & Review" tab of your App settings and make sure that checkbox on top says "YES".
Most permissions (like user_photos) need to get reviewed by Facebook before you can use them for any other user: https://developers.facebook.com/docs/apps/review/login

Get ALL User Friends Using Facebook Graph API - Android [duplicate]

This question already has answers here:
Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application
(8 answers)
Closed 8 years ago.
I'm trying to get all friends, of a user that logged into my application.
I can't use this API [friends]:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/friends
Because this API only returns any friends who have used the app making the request.
So I found this API [friendlist]:
https://developers.facebook.com/docs/graph-api/reference/v2.0/friendlist
Followed this answer, I got the friendlist list.
But I'm getting empty list when trying to get friendlist's members:
new Request(
session,
"/2692926356774/members",
null,
HttpMethod.GET,
new Request.Callback()
{
public void onCompleted(Response response)
{
/* handle the result */
Log.e(LOG_TAG,"Members: " + response.toString());
}
}
).executeAsync();
2692926356774 is my Acquaintances list id, I tried few other id's with the same result.
In v2.0 of the Graph API, calling /me/friends returns the person's friends who also use the app.
In addition, in v2.0, you must request the user_friends permission from each user. user_friends is no longer included by default in every login. Each user must grant the user_friends permission in order to appear in the response to /me/friends. See the Facebook upgrade guide for more detailed information, or review the summary below.
The /me/friendlists endpoint and user_friendlists permission are not what you're after. This endpoint does not return the users friends - its lets you access the lists a person has made to organize their friends. It does not return the friends in each of these lists. This API and permission is useful to allow you to render a custom privacy selector when giving people the opportunity to publish back to Facebook.
If you want to access a list of non-app-using friends, there are two options:
If you want to let your people tag their friends in stories that they publish to Facebook using your App, you can use the /me/taggable_friends API. Use of this endpoint requires review by Facebook and should only be used for the case where you're rendering a list of friends in order to let the user tag them in a post.
If your App is a Game AND your Game supports Facebook Canvas, you can use the /me/invitable_friends endpoint in order to render a custom invite dialog, then pass the tokens returned by this API to the standard Requests Dialog.
In other cases, apps are no longer able to retrieve the full list of a user's friends (only those friends who have specifically authorized your app using the user_friends permission).
For apps wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the new Message Dialog on iOS and Android.

Created New Facebook Application for Android publish permission not working.Used Facebook sdk 3.14.xx and samples

I am using facebook sdk 3.14(latest updated sdk) and created application for android platform
like other old applications which i have added same options and everything.
i want to use share photo feature for that I am using below code to add publish_actions permission. but permission is not getting updated or granted.
** I have checked with other old application which i have created last month which is working fine with same code photo sharing and all is working , permissions also getting add.
But application which i have created today.with that app id I am not able to add permission for publish.
if (session.isOpened()) {
// We need to get new permissions, then complete the action when
// we get called back.
Session.NewPermissionsRequest permission = new NewPermissionsRequest(
this, PERMISSION);
permission.setCallback(new StatusCallback() {
#Override
public void call(Session session, SessionState state,
Exception exception) {
//session.getPermissions() //here m not getting publish_permission in list
Log.e("", "");
}
});
session.requestNewPublishPermissions(permission);
return;
}
i have also tried with samples which is provided with facebook sdk.
onActivity result and all are as per facebook sample given in sdk .
any help?
** try to create new facebook application and use that app id.
I found the solution for testing facebook application.After 30th April facebook changed some structure regarding roles.For testing some of the permissions like publish_actions , friends related need to add roles in facebook app.Add testers and developer roles in facebook application after adding role(s) i am able to test that sharing image and other things with that added testers or developer id.For live now its required to post application for review process.After login into developer account Open facebook application and check the Roles Menu.

How to like facebook messages

In my application I have one expandable list view which displays Facebook messages.
When a user clicks the list view then a child view opens in that I have a button called Like. By clicking the Like button the original message should be liked in Facebook
One important thing is that it should not ask login details from the user. I searched a lot on the web but I find any good tutorial.
I don't have any basic idea of Facebook. Please provide me with some suggestions of how to do it.
Thanks
Well, if you want to like Facebook messages, you need to ask a permission for that with the Facebook SDK :
https://github.com/facebook/facebook-android-sdk
So Basically, you can do SSO with Facebook SDK, he will just ask for the permission needed if the user is already logged on his Facebook application.
Take a look at the sample on the Android SDK Facebook on the link above.
When you have the "like" permission (publish_stream), you can do it like that :
Request likeFacebook = new Request(Session.getActiveSession(), fBPostId + "/likes", null, HttpMethod.POST, new Request.Callback() {
#Override
public void onCompleted(Response response) {
// analyse your response
}
});
Request.executeBatchAndWait(likeFacebook);

Categories

Resources