Openssl handshake failed when using getInputStream() on Facebook profile picture in android sdk -
Openssl handshake failed when using getInputStream() on Facebook profile picture in android sdk -
i trying create user profile page app. succeed connecting facebook, have user basic profile using userprofile = profile.getcurrentprofile();
trying create drawable of user profile image set in image view. created inputstream fetch image(running on asynctask)
bitmap x; url = new url("https://graph.facebook.com/939344862743414/picture?height=200&width=200"); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setrequestproperty("user-agent","mozilla/4.0"); connection.setconnecttimeout(100000); connection.connect(); bufferedinputstream buf = new bufferedinputstream(connection.getinputstream()); x = bitmapfactory.decodestream(buf);
however no matter do,the app failed , crash when reach connection.getinputstream(). error javax.net.ssl.sslprotocolexception: ssl handshake aborted couldn't find help on web .it doesn't seem authorization problem because can connect facebook , fetch data. doing wrong?
the issue created url. url contains https
means web server certificate issued known ca, can create secure request. using httpurlconnection
doesn't back upwards secured url.
so can enable access secured url (https://..
) using urlconnection
in place of httpurlconnection. modify next line:
httpurlconnection connection = (httpurlconnection) url.openconnection();
with one:
urlconnection connection = (urlconnection) url.openconnection();
detail info can found here.
android facebook inputstream facebook-sdk-4.0 sslhandshakeexception
Comments
Post a Comment