android - Graph request doesn not work Facebook -
i want name ,picture , email facebook while im debbugin fine until code reaches graph request, code not pass graph request , jump next breakpoint
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); setcontentview(r.layout.login); textviewfullname = (textview) findviewbyid(r.id.txtnombreusuario); textviewemail = (textview) findviewbyid(r.id.txtemailusuario); imageviewphoto = (imageview) findviewbyid(r.id.imageview); botonregistrate=(button) findviewbyid(r.id.btn_registrate); botonregistrate.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(getapplicationcontext(), registrarnuevousuarioactivity.class); startactivity(intent); } }); buttonloginfacebook = (loginbutton) findviewbyid(r.id.connectwithfbbutton); buttonloginfacebook.setreadpermissions(arrays.aslist( "public_profile", "email")); facebooksdk.setisdebugenabled(true); facebooksdk.addloggingbehavior(loggingbehavior.include_access_tokens); buttonloginfacebook.registercallback(callbackmanager, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { getfacebookprofiledetails(); intent intent = new intent(getapplicationcontext(), mainactivity.class); startactivity(intent); } @override public void oncancel() { } @override public void onerror(facebookexception error) { } }); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); callbackmanager.onactivityresult(requestcode, resultcode, data); } private void getfacebookprofiledetails() { graphrequest request = graphrequest.newmerequest(accesstoken.getcurrentaccesstoken(), new graphrequest.graphjsonobjectcallback() { //the code doesn not pass here @override public void oncompleted(final jsonobject object, graphresponse response) { try { profile profiledefault = profile.getcurrentprofile(); picasso.with(loginactivity.this).load(profiledefault.getprofilepictureuri(100,100)).transform(new circletransform()).into(imageviewphoto); textviewfullname.settext(profiledefault.getfirstname()); textviewemail.settext(object.getstring("email")); } catch (exception e) { //log.e("e-mainactivity", "getfacebook" + e.tostring()); } } }); bundle parameters = new bundle(); parameters.putstring("fields", "email"); request.setparameters(parameters); request.executeasync();
Comments
Post a Comment