Archana
Archana

Reputation: 519

getting facebook username and user profile image by email address?

i want to fetch user profile image and name by using user email address. i am using facebook graph api

in my app user are able to post questions in your wall. and so he will get the responses by other users and we have only their email id so i have problem that how we access profile image and user id by using email address.

right now i am using facebook permission given below:

private static final String[] PERMISSIONS = new String[] {
            "publish_stream", "read_stream", "offline_access" };

is there any other permission to access profile info by email address.. please figure out my problem...

Upvotes: 0

Views: 2376

Answers (3)

Mani
Mani

Reputation: 311

For fetching user name and profile pic follow these steps-

  1. Put this Permission-

    public static final String[] FACEBOOK_PERMISSIONS = new String[] {"publish_stream","email"};

  2. Put this code in onComplete(Bundle mBundle) method -

    JSONObject response = Util.parseJson(facebook.request("/me", mBundle, "GET"));

  3. Get user name -

    String userName = response.getString("username")

    Now to get URL for profile pic make URL like this-

    https://graph.facebook.com/userName/picture

    For More details visit here.

Upvotes: 1

bkaid
bkaid

Reputation: 52093

You used to be able to search Facebook graph by email address to find a users name and image, but Facebook broke it and has taken months to fix it.

Upvotes: 0

Richard Barnett
Richard Barnett

Reputation: 1108

The Facebook api doesn't allow you to find a profile given its email address. But if you have an access token that lets you read a user's wall, you should also be able to use it to obtain the profile image & display name for the author of each wall post.

Upvotes: 0

Related Questions