Launch new activity after successful Facebook login, Facebook Api v.4.0 | Android -
i'm android noob , want use facebook api login app. have managed setup facebook login using loginbutton class on fragment facebook documentation. can login using facebook, each time succesfully login logout button need able redirect activity after successful login or when logged in. how can track login status , redirect since in api 4.0 session doesn't work?
make sure activity or fragment implements facebookcallback
(my exampel here uses fragment, easy adapt.) make sure have following member variables:
callbackmanager mfacebookcallbackmanager; loginbutton mfbloginbutton;
then setup variables in oncreate:
mfacebookcallbackmanager = callbackmanager.factory.create(); mfbloginbutton = (loginbutton) getview().findviewbyid(r.id.facebook_login_button); mfbloginbutton.setfragment(this); mfbloginbutton.registercallback(mfacebookcallbackmanager, this);
ensure add enable callback:
@override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); mfacebookcallbackmanager.onactivityresult(requestcode, resultcode, data); }
the facebookcallback give method:
@override public void onsuccess(object o) { toast.maketext(getactivity(), "facebook onsuccess", toast.length_short).show(); }
you can start new activity onsuccess. luck.
Comments
Post a Comment