Facebook graph user picture won't show on mobile devices

I use the url https://graph.facebook.com/{app_user_id}/picture?width=120&height=120 to show the user picture on my app, but since this morning, it has stopped working on mobile devices.

Now, the same url redirects to https://lookaside.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120. This url works on desktop web, but on mobile it redirects again to https://m.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120 and the mobile web refuses to output the image. If I try to load it in the address bar, it is downloaded instead of showed.

I have searched for any change on the Facebook graph api about this but didn't find anything. Any hint to solve this? Thanks.


Solution 1:

This seems to be a bug. Started happening to my app earlier on this morning. Still no fix as of yet.

A few bug reports that have been submitted on Facebook for Developers:

  1. Profile Pictures Can't Load
  2. Graph API Profile picture doesn`t work on mobile
  3. Cross site policy error while accessing graph pictures

Solution 2:

I faced the same issue today and I'v found a solution for that and it worked for me.

After login we get below Profile pic URL

http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420

11111111111 is your social id/facebook id

now we need to change this URL in order to display image, here is the code.

try {
     profile_pic = new URL("https://graph.facebook.com/" + id + "/picture?type=large");
     Log.i("profile_pic", profile_pic + "");
     Picasso.with(getContext()).
     load(profile_pic.toString())
     .placeholder(R.drawable.img)
     .into(imageviewId);
     }
catch (MalformedURLException e) {
       e.printStackTrace();
    }

id is your socialid/facebook id

in short we just need to remove &height=320&width=420 from url.

you can compare both the url:

http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420

https://graph.facebook.com/11111111111/picture?type=large

and yes you need to change http to https as well