Ich benutze das offizielle Facebook SDK in meiner Android-Anwendung. Nachdem der Benutzer anmeldet, kann ich wie so die uid und den Namen der Facebook-Nutzer erhalten:Android und Facebook: Wie bekomme ich ein Bild von eingeloggt Benutzer
Facebook mFacebook = new Facebook(APP_ID);
// ... user logs in ...
//String jsonUser = mFacebook.request("me/picture"); // throws error
String jsonUser = mFacebook.request("me");
JSONObject obj = Util.parseJson(jsonUser);
String facebookId = obj.optString("id");
String name = obj.optString("name");
Ich weiß auch, dass das ich das Profilbild mit diesen Links erreichen:
https://graph.facebook.com/<facebookId>/picture
https://graph.facebook.com/<facebookId>/picture?type=large
Ich würde gerne diesen Code verwenden, um das Profilbild zu gehen:
public static Drawable getPictureForFacebookId(String facebookId) {
Drawable picture = null;
InputStream inputStream = null;
try {
inputStream = new URL("https://graph.facebook.com/" + facebookId + "/picture").openStream();
} catch (Exception e) {
e.printStackTrace();
return null;
}
picture = Drawable.createFromStream(inputStream, "facebook-pictures");
return picture;
}
Aber es wird einfach nicht funktionieren. Ich bekomme immer folgenden Fehler:
SSL handshake failure: Failure in SSL library, usually a protocol error
Und ich kann dieses Problem nicht lösen. Es scheint ziemlich kompliziert zu sein (siehe here oder here). Welche anderen Möglichkeiten gibt es, um das Bild eines Facebook-Nutzers zu erhalten, der sich erfolgreich in meiner Anwendung angemeldet hat?
angegebenen Link ist jetzt tot! – prometheuspk