Reputation: 1844
I am using Facebook SDK 3.5 for integrating facebook login and fetching details of logged In user via android application. Please have a look over my code where i could achieve to fetch various info of logged In user.
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
String firstName = user.getFirstName();
String lastName = user.getLastName();
String id = user.getId();
String email = user.getProperty("email").toString();
Log.e("facebookid", id);
Log.e("firstName", firstName);
Log.e("lastName", lastName);
Log.e("email", email);
String total = id + "," + firstName + "," + lastName +","+email;
welcome.setText(total);
System.out.println("##facebookid"+ id);
System.out.println("##firstName"+ firstName);
System.out.println("##lastName"+ lastName);
System.out.println("##email"+ email);
}
}
});
But i didn't find any clue about the Employer Details of logged In user. How can i achieve this information. Is that possible or no. Please help.
Upvotes: 0
Views: 645
Reputation: 17441
This functionality appears to be provided at user endpoint using additional parameters concordant with your search.
For example:
https://graph.facebook.com/me?fields=work
From https://developers.facebook.com/docs/reference/api/user/
work
: A list of the user's work history
user_work_history
or friends_work_history
You can reasonably find the user's current employer by inspecting the start_date
and end_date
respectively. For a different user than the current user, replace me
with the desired PROFILE_ID
.
do like this
session.openForRead(new Session.OpenRequest(activity)
.setCallback(statusCallback)
.setPermissions(
Arrays.asList("user_work_history,email,user_birthday,user_location,user_hometown,user_about_me,user_relationships,friends_about_me,friends_likes,friends_photos")));
after you can do this in your userinfo function
user.getProperty("work").toString();
Upvotes: 1