Skip to content Skip to sidebar Skip to footer

Error Retrieving Email And Location From Facebook Request In Android

I am using facebook sdk 3.5 in native Android. This is how i get the id/name of my facebook freinds: private void onSessionStateChange(final Session session, SessionState s

Solution 1:

Go to this link Graphapilink

Click the Graph API Explorer icon-> Then select your application name "YourApplication"-> Then click the GetAccesTocken .it show the Select Permission Pop Up window.->Then you select the Extended Permission tab.

enter image description here

Finally you will be select the necessary permission you want as the picture above

Solution 2:

  • Facebook doesn't allow apps to access friends emails

For the Rest See The Below Images.. You have to set the right permissions and see how it works in my profile

enter image description here

enter image description here

And The result you will get

enter image description here

Solution 3:

Your query:

"me/friends?fields=id,name,location,email"

That means you are trying to fetch name, location, email. You can get the name, but for the location you need the permission friends_location; for email- facebook dont allow you to fetch the email of the friends.

I hope i don;t have to create a request for each of my friends to get data

Of-course not. Your query is right, you'll get an array in the result just like-

{
  "data": [
    {
        "name": Friend1_Name, 
        "location": {
           "id": Friend1_LocationID, 
           "name": Friend1_Location
        }, 
        "id": Friend1_ID
    }, 
    {
        "name": Friend2_Name, 
        "location": {
           "id": Friend2_LocationID, 
           "name": Friend2_Location
        }, 
        "id": Friend2_ID
    }, 
    ....
    ....
 ]
}

Live Demo


If you're getting-

"An active access token must be used to query information about the current user.","type":"OAuthException"

That means the (current) user has not logged into your app, or the session is expired. So, login/auth the user then make the API call.

Post a Comment for "Error Retrieving Email And Location From Facebook Request In Android"