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
Related
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
first, I'am sorry. i can't english well.
i have a problem in facebook sdk.
now i am developing login with facebook sdk.
and logout too.
but i can't find unlink api between my-app and facebook.
for example, some user using my app do not want to use my app more.
so he needs to ban me(or my app) in order to protect his data on facebook.
do you understand me? T.T please help me.
following flow is when the user unlinks the app himself directly.
but i want to do this in my app menu with login, logout, etc.
Menu Flow : (in facebook app settings) Apps -> Logged in with Facebook -> (choice a app) -> Remove App
FB.api("/me/permissions","DELETE",function(response){
console.log(response); //gives true on app delete success
});
You need a active access token of user to do this
Using Facebook sdk
new Request(
session,
"/me/permissions/{permission-to-revoke}",
null,
HttpMethod.DELETE,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
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
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.
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);