Search in sources :

Example 1 with IdentityProvider

use of com.amazonaws.mobile.auth.core.IdentityProvider in project aws-sdk-android by aws-amplify.

the class SignInUI method presentAuthUI.

/**
 * Initiate the sign-in flow.
 * Resume any previously signed-in Auth session.
 * Check if the user is not signed in and present the AuthUI screen.
 */
private void presentAuthUI() {
    Log.d(LOG_TAG, "Presenting the SignIn UI.");
    final IdentityManager identityManager = IdentityManager.getDefaultIdentityManager();
    final boolean canCancel = this.authUIConfiguration.getCanCancel();
    identityManager.login(this.loginCallingActivity, new DefaultSignInResultHandler() {

        @Override
        public void onSuccess(Activity activity, IdentityProvider identityProvider) {
            if (identityProvider != null) {
                Log.d(LOG_TAG, "Sign-in succeeded. The identity provider name is available here using: " + identityProvider.getDisplayName());
                startNextActivity(activity, loginNextActivity);
            }
        }

        @Override
        public boolean onCancel(Activity activity) {
            // Return true to allow this.
            return canCancel;
        }
    });
    SignInActivity.startSignInActivity(this.loginCallingActivity, this.authUIConfiguration);
}
Also used : DefaultSignInResultHandler(com.amazonaws.mobile.auth.core.DefaultSignInResultHandler) IdentityManager(com.amazonaws.mobile.auth.core.IdentityManager) Activity(android.app.Activity) IdentityProvider(com.amazonaws.mobile.auth.core.IdentityProvider)

Aggregations

Activity (android.app.Activity)1 DefaultSignInResultHandler (com.amazonaws.mobile.auth.core.DefaultSignInResultHandler)1 IdentityManager (com.amazonaws.mobile.auth.core.IdentityManager)1 IdentityProvider (com.amazonaws.mobile.auth.core.IdentityProvider)1