问题
I made an application in android in which I set Facebook authentication on button click. But when I click that button it comes back to my activity.
I know that problem is that : I can not log in to Facebook because I have already signed in with Facebook app in my device.
Then my question is how can I log in separately in my Android app and Facebook app?
回答1:
if u have used fb sdk than in class FacebookConnector change the login method as shown below
public void login() {
if (!facebook.isSessionValid()) {
facebook.authorize(this.activity, this.permissions,-1,new LoginDialogListener());
}
}
may it works
回答2:
finally I solved the problem using this:
Open Facebook.java provided by facebook sdk and then i had changes like this:
public void authorize(Activity activity, String[] permissions,
int activityCode, final DialogListener listener) {
boolean singleSignOnStarted = false;
mAuthDialogListener = listener;
/* // Prefer single sign-on, where available.
if (activityCode >= 0) {
singleSignOnStarted = startSingleSignOn(activity, mAppId,
permissions, activityCode);
}
// Otherwise fall back to traditional dialog.
if (!singleSignOnStarted) {*/
startDialogAuth(activity, permissions);
// }
}
Finally i can able to login in both app in my device
来源:https://stackoverflow.com/questions/10551475/can-not-authenticate-in-facebook