Android - get facebook profile picture

后端 未结 28 2390
花落未央
花落未央 2020-12-12 15:13

I don\'t know why, but I am always getting null when I try to get the profile picture of the user. Do I need to set some specific permissions to get access?

Below is

28条回答
  •  没有蜡笔的小新
    2020-12-12 15:52

    When you make request like this:

    http://graph.facebook.com/103407310026838/picture?type=square&type=large
    

    it makes a redirect to other url..

    You need to add an extra param on Get request

    redirect=false
    

    Like this

    http://graph.facebook.com/103407310026838/picture?type=square&type=large&redirect=false
    

    and you will get the a Json with Real Image url..

    Like this :

    {
       "data": {
          "is_silhouette": true,
          "url": "https://scontent.xx.fbcdn.net/v/t1.0-1/s200x200/1379841_10150004552801901_469209496895221757_n.jpg?oh=4234dcdfc832a58b9ef7a31c7896c73c&oe=57DD01F8"
       }
    }
    

    finally make new request to get the image that you found in data->url

提交回复
热议问题