java - login facebook android notworking -
when install app eclipse on real device works ok login face book sample app
but when exporting apk , install manually mobile when hit login hit ok facebook permission again login screen
i don't know why not working apk version
my code :
public class loginactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); loginface.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { // call logout twitter function // start facebook login session.openactivesession(loginactivity.this, true, new session.statuscallback() { // callback when session changes state @override public void call(session session, sessionstate state, exception exception) { if (session.isopened()) { // make request /me api request.executemerequestasync(session, new request.graphusercallback() { // callback after graph api response user object @override public void oncompleted(graphuser user, response response) { if (user != null) { textview welcome = (textview) findviewbyid(r.id.user_name); welcome.settext("hello " + user.getname() + "!"); } } }); } } }); } }); @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); session.getactivesession().onactivityresult(this, requestcode, resultcode, data); }
xml file:
<button android:id="@+id/btn_fblogin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5dp"/>
works me.....
` session.openactivesession(this, true, new session.statuscallback() {
// callback when session changes state @override public void call(session session, sessionstate state, exception exception) { request.newmerequest(session, new request.graphusercallback() { @override public void oncompleted(graphuser user, response response) { } }).executeasync(); } });`
Comments
Post a Comment