Facebook android sdk internal server error -
i want integrate facebook signin in android app. using facebook-sdk-4.4.0 getting blank screen. tried debug app using fiddler , noticed webview not able created because request facebook getting 500 internal server error response.
please figure out mistake making.
try code. it's work successfully.
callbackmanager = callbackmanager.factory.create(); loginbutton = (loginbutton) findviewbyid(r.id.login_button); list < string > permissionneeds = arrays.aslist("user_photos", "email", "user_birthday", "public_profile", "accesstoken"); loginbutton.registercallback(callbackmanager, new facebookcallback < loginresult > () {@override public void onsuccess(loginresult loginresult) { system.out.println("onsuccess"); string accesstoken = loginresult.getaccesstoken() .gettoken(); log.i("accesstoken", accesstoken); graphrequest request = graphrequest.newmerequest( loginresult.getaccesstoken(), new graphrequest.graphjsonobjectcallback() {@override public void oncompleted(jsonobject object, graphresponse response) { log.i("loginactivity", response.tostring()); try { string id = object.getstring("id"); try { url profile_pic = new url( "http://graph.facebook.com/" + id + "/picture?type=large"); log.i("profile_pic", profile_pic + ""); } catch (malformedurlexception e) { e.printstacktrace(); } string name = object.getstring("name"); string email = object.getstring("email"); string gender = object.getstring("gender"); string birthday = object.getstring("birthday"); } catch (jsonexception e) { e.printstacktrace(); } } }); bundle parameters = new bundle(); parameters.putstring("fields", "id,name,email,gender, birthday"); request.setparameters(parameters); request.executeasync(); } @override public void oncancel() { system.out.println("oncancel"); } @override public void onerror(facebookexception exception) { system.out.println("onerror"); log.v("loginactivity", exception.getcause().tostring()); } });
@override protected void onactivityresult(int requestcode, int responsecode, intent data) { super.onactivityresult(requestcode, responsecode, data); callbackmanager.onactivityresult(requestcode, responsecode, data); }
for step step code check answer here. facebook login sdk4
Comments
Post a Comment