Skip to content

Configuring SmartLoginCallbacks

Kalyan Dechiraju edited this page Apr 23, 2017 · 4 revisions

SmartLoginCallbacks

The first step in configuring Android-Smart-Login Library is to implement SmartLoginCallbacks in your Login Activity.

public class LoginActivity extends AppCompatActivity implements SmartLoginCallbacks {

...

@Override
    public void onLoginSuccess(SmartUser user) {
        // This method is invoked after successful login
        // The passed in user is already saved into app's session
    }

    @Override
    public void onLoginFailure(SmartLoginException e) {
        // This method is invoked in the case of any exception during login flow.
        // Check exception object e for more details
    }

    @Override
    public SmartUser doCustomLogin() {
        // This is the place to implement you custom user login
        // logic with you backend server and return the user object.
        // Returning null indicates a failure in the login flow.
        SmartUser user = new SmartUser();
        user.setEmail(emailEditText.getText().toString());
        return user;
    }

    @Override
    public SmartUser doCustomSignup() {
        // This is the place to implement you custom user signup
        // logic with you backend server and return the user object.
        // Returning null indicates a failure in the signup flow.
        SmartUser user = new SmartUser();
        user.setEmail(emailEditText.getText().toString());
        return user;
    }

}
Clone this wiki locally