Conductor: Facebook Login

Created on 28 Apr 2017  ·  1Comment  ·  Source: bluelinelabs/Conductor

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!

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomblenz picture tomblenz  ·  4Comments

PaulWoitaschek picture PaulWoitaschek  ·  5Comments

EmkaMk picture EmkaMk  ·  10Comments

EricKuck picture EricKuck  ·  5Comments

ZakTaccardi picture ZakTaccardi  ·  8Comments