android - How to handle Twitter and facebook request code -
how handle twitter , facebook request code on activityresult.
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); // if request code of facebook call other function , if // request code of twitter call other function // how can seprate both request code. }
you have 2 options :
1) on click of fb or twitter button, set boolean value true , check button clicked determine method want call.
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (fb_clicked == true) { //call callback manager's onactivityresult } else if(twitter_clicked == true) { //call twitter login button's onactivityresult } }
2) or can use auth token determine button clicked auth token generated when click on loginbutton (twitter or facebook , other should null)
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (accesstoken.getcurrentaccesstoken() !=null) //call callback manager's onactivityresult else { //call twitter login button's onactivityresult } }
Comments
Post a Comment