Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook android app permission: ask for get user profile picture

i'm write android app that use facebook api, and i need that my app can retrieve user profile picture.

This is my current permissions:

fb_login_button.setReadPermissions(Arrays.asList("public_profile", "user_friends"));

but i don't see in documentation any permission for get user profile picture, but only permission for access to ALL pictures (i'm not interested about it). So, profile picture is now accessible without any permission

like image 243
giozh Avatar asked Nov 28 '25 09:11

giozh


2 Answers

The public_profile permission does give you profile picture as well.

This is how you will get the profile picture

public static Bitmap getFacebookProfilePicture(String userID){
URL imageURL = new URL("https://graph.facebook.com/" + userID + "/picture?type=large");
Bitmap bitmap = BitmapFactory.decodeStream(imageUrl.openConnection().getInputStream());

return bitmap;
 }

 Bitmap bitmap = getFacebookProfilePicture(userId);

Refer: Android - get facebook profile picture

like image 101
Jazib Avatar answered Nov 29 '25 23:11

Jazib


You don't need any special permission get the profile picture. Using the permission "public_profile" you can get the user's id. if you have the user id , you can get the profile picture by using the graph api , as follows.

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

if you use redirect=false, you will get a json as follows.

{
   "data": {
      "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xaf1/t1.0-1/c92.62.775.775/s50x50/564992_463610327023364_1165619683_n.jpg",
      "is_silhouette": false
   }
}

The "url" in the json will give the user's profile picture. You can also use it without reidrect.

like image 31
JIthin Avatar answered Nov 30 '25 00:11

JIthin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!