1
votes

So I'm trying to simply fetch the user's profile photo from facebook but I'm getting a null response from facebook.request(path) and the IOException "Hostname fbcdn-profile-a.akamaihd.net was not verified".

Anyone know what could be causing this exception? Here's my method to call the facebook.request:

public Bitmap getUserPic(String path){

    URL picURL = null;


    try {
        responsePic = facebook.request(path);
        picURL = new URL(responsePic);
        HttpURLConnection conn = (HttpURLConnection)picURL.openConnection();
        conn.setDoInput(true);
        conn.connect();
        InputStream is = conn.getInputStream();
        userPic = BitmapFactory.decodeStream(is);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (FacebookError e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return userPic;

}

The string "path" is "me/picture"

Edit:

Also tried setting picURL to "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/260885_608260639_822979518_q.jpg" which is the url that the request should return. Still no photo :(

Thanks for any help

1

1 Answers

0
votes

It sounds like a issue with the HTTPS connection used to get the image from the Facebook CDN. What happens if you request the regular HTTP version of the image?

E.g. http://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/260885_608260639_822979518_q.jpg