Skip to content Skip to sidebar Skip to footer

Firebaseui Custom Layout Doesn't Show

I have created a custom layout for authentication, but the layout is not shown and Email login screen is displayed instead val customLayout = AuthMethodPickerLayout.Builder(R.layou

Solution 1:

First you need to set Provider list:

List<IdpConfig> selectedProviders = new ArrayList<>();
            selectedProviders.add(new AuthUI.IdpConfig.EmailBuilder().build());
            selectedProviders.add(new AuthUI.IdpConfig.PhoneBuilder().build());

Kotlin:

val selectedProviders = mutableListOf<AuthUI.IdpConfig>()
    providers.add(AuthUI.IdpConfig.EmailBuilder().build())
    providers.add(AuthUI.IdpConfig.PhoneBuilder().build())

then create SinginIntentBuilder:

            AuthUI.SignInIntentBuilderbuilder= AuthUI.getInstance().createSignInIntentBuilder();

Create custom layout as you have already created:

AuthMethodPickerLayoutcustomLayout=newAuthMethodPickerLayout
                    .Builder(R.layout.activity_login) //your layout name
                    .setPhoneButtonId(R.id.buttonPhone)
                    .setEmailButtonId(R.id.buttonEmail)
                    .build();

then pass builder and provider and start activity for result:

startActivityForResult(builder.setAuthMethodPickerLayout(customLayout)
                    .setAvailableProviders(selectedProviders)//provider list.setTheme(R.style.AppTheme)//app theme or whatever theme you want.setIsSmartLockEnabled(false)
                    .build(),RC_SIGN_IN);

Post a Comment for "Firebaseui Custom Layout Doesn't Show"