Is there an example of setting up Conductor to use the Facebook SDK?
I read through the issue (https://github.com/bluelinelabs/Conductor/issues/17) where a work-around was devised, but I'm too new to Conductor to understand the final solution that was agreed upon.
I setup the Facebook stuff (CallbackManger, LoginButton, etc) in my Controller:
protected View onCreateView() {
// ...
// ...
// FACEBOOK
mCallbackManager = CallbackManager.Factory.create();
mFacebookLoginButton.setReadPermissions(“email”);
mFacebookLoginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
AccessToken token = loginResult.getAccessToken();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
}
});
registerForActivityResult(CallbackMangerImpl.requestCodeOffset.Login.toRequestCode());
}
and I setup my
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
in the Controller, but onActivityResult() is never called while debugging!
First you need this in your base activity:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
router?.onActivityResult(requestCode, resultCode, data)
}
Then you need to register the Facebook request code to your Controller:
init {
registerForActivityResult(CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode())
}
Hope it helps.
Most helpful comment
First you need this in your base activity:
Then you need to register the Facebook request code to your Controller:
Hope it helps.