I am trying to get birthday of my friends, those who have installed my sample app. Below is my code.
new Request(simpleFacebook.getSession(), "/" + id, null, HttpMethod.GET,
new Request.Callback() {
@Override
public void onCompleted(Response response) {
String rawResponse = response.getRawResponse();
AppLog.showLog(TAG, "Friend response is " + rawResponse);
}
}
).executeAsync();
But in response there is no any "birthday" filed.
I also used simplefacebook library. Using below code
PictureAttributes pictureAttributes = Attributes.createPictureAttributes();
pictureAttributes.setType(PictureAttributes.PictureType.SQUARE);
pictureAttributes.setWidth(250);
pictureAttributes.setHeight(250);
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.NAME)
.add(Profile.Properties.BIRTHDAY)
.add(Profile.Properties.PICTURE)
.add(Profile.Properties.ID)
.build();
simpleFacebook.getProfile(id, properties, new OnProfileListener() {
@Override
public void onComplete(Profile response) {
String id = response.getId();
String name = response.getName();
String birthday = response.getBirthday();
String pictureUrl = response.getPicture();
AppLog.showLog(TAG, "Single friend Detail: " + id + "\t" +
name + "\t" + birthday + "\t" + pictureUrl);
FbFriendsDao fbFriendsDao = new FbFriendsDao(LoginActivity.this);
fbFriendsDao.openForWrite();
fbFriendsDao.insertFriends(new FbFriendDto(id, name, birthday, pictureUrl));
}
@Override
public void onException(Throwable throwable) {
super.onException(throwable);
}
@Override
public void onFail(String reason) {
super.onFail(reason);
}
@Override
public void onThinking() {
super.onThinking();
}
});
But it gives null in birthday filed. Please help to solve this problem. Thanks in advance.
As @luschn mentioned, all friends_*
permissions have been removed, including friends_birthday
.
However it is still possible to get some data if:
user_birthday
permission (note you'll need this approved by FB)You can do this by adding "birthday" to the fields
key in me/friends
:
me/friends?fields=id,name,birthday
Alternatively, you could simply save the user data to your own database when the user signs up and then retrieve it later, which would give you exactly the same outcome.