Facebook authentication via android app -



Facebook authentication via android app -

i new android. developing application requires facebook login proceed. have followed tutorial - https://developers.facebook.com/docs/android/getting-started

edit: using uilifecyclehelper, same thing happen, 1 time user authenticates application application closed.

private session.statuscallback callback = new session.statuscallback() { @override public void call(session session, sessionstate state, exception exception) { if (session.isopened()) { log.w("vinit", "session started"); // create request /me api request.newmerequest(session, new request.graphusercallback() { // callback after graph api response user object @override public void oncompleted(graphuser user, response response) { if (user != null) { textview t = (textview) findviewbyid(r.id.textview1); t.settext("user: " + user.getfirstname()); } } }).executeasync(); } } }; private facebookdialog.callback dialogcallback = new facebookdialog.callback() { @override public void onerror(facebookdialog.pendingcall pendingcall, exception error, bundle data) { log.d("hellofacebook", string.format("error: %s", error.tostring())); } @override public void oncomplete(facebookdialog.pendingcall pendingcall, bundle data) { log.d("hellofacebook", "success!"); } }; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); if(new loginchecker(this).isregistered()){ intent intent = new intent(this, mainactivity.class); startactivity(intent); }else{ setcontentview(r.layout.activity_login); loginbutton loginbutton = (loginbutton) findviewbyid(r.id.loginbutton1); thisactivity = this; loginbutton.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub uihelper = new uilifecyclehelper(thisactivity, callback); } }); } } @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); log.w("vinit", "on activity result function"); uihelper.onactivityresult(requestcode, resultcode, data, dialogcallback); }

use uilifecyclehelper https://developers.facebook.com/docs/reference/android/current/class/uilifecyclehelper sure activity/fragment handle processing facebook component in proper way. check facebook session object. app phone call instructions within session.isopened()? seek debug code see state of facebook session.

android facebook facebook-graph-api authentication

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -