firebase email verification fails in android 12 devices

136 views
Skip to first unread message

Abhi

unread,
Jul 2, 2022, 10:46:51 AM7/2/22
to Firebase Google Group
I am using android studio and firebase to design my app. When user register in my app, I used to send an email with verification link to verify their email. The code I used for sending email verification link is shown below. It was working fine up to devices with android 11, and I was successful in sending verification emails links to registered email ids using a line of code " mAuth.getCurrentUser().sendEmailVerification();" , but for android 12 devices it is not sending verification links. I read "Verify Android App Links"   in developer documents but I couldn't able to solve the issue.. Whether I need to do any change in code or I need do any addition in Manisfest file.. if any one knows please help

 private void registerSeller() {

        String Name= name.getText().toString();
        String Email= email.getText().toString();
        String Password=password.getText().toString();
        String ConfirmPass=ConfirmPassword.getText().toString();

        if( !Name.equals("") && !Email.equals("") &&  !Password.equals("")
           )
        {
            if (Email.matches(emailPattern)) {

                if(password.length() >= 4 && password.length() <=15 &&  Password.matches(passwordPattern) ){

                    if (Password.matches(ConfirmPass)) {
                            loadingBar.setTitle("Creating seller account ");
                            loadingBar.setMessage("please wait, while we are creating your account..."); /.
                            loadingBar.setCanceledOnTouchOutside(false); //  
                            loadingBar.show();
                            mAuth.createUserWithEmailAndPassword(Email, Password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { //HERE I CREATE account
                                @Override
                                public void onComplete(@NonNull Task<AuthResult> task) {
                                    if (task.isSuccessful()) {
                                        loadingBar.dismiss();
                                        mAuth.getCurrentUser().sendEmailVerification(); //********HERE I SEND Verification Link**************
                                        Toast.makeText(SellerRegistrationActivity.this, "Registration Successful. Please verify your email ID", Toast.LENGTH_LONG).show();
                                        name.setVisibility(View.INVISIBLE);
                                        email.setVisibility(View.INVISIBLE);
                                        password.setVisibility(View.INVISIBLE);
                                        ConfirmPassword.setVisibility(View.INVISIBLE);
                                        Seller_register.setVisibility(View.INVISIBLE);
                                        continueBtn.setVisibility(View.VISIBLE);
                                    } else {
                                        String message = task.getException().toString(); // get the error ocuured  from net/firebase
                                        Toast.makeText(SellerRegistrationActivity.this, "Error : " + message, Toast.LENGTH_SHORT).show();
                                        loadingBar.dismiss();
                                    }
                                }
                            });

                    }else{
                        Toast.makeText(SellerRegistrationActivity.this,"Password and confirm password not matching ",Toast.LENGTH_LONG).show();
                    }

                }
                else
                    {
                Toast.makeText(SellerRegistrationActivity.this,"Password should have at least one upper case letter, one lower case letter, one number and one special character  and  should  be between 4 to 15 characters long, Example-Best@123 ",Toast.LENGTH_LONG).show();

                }

            }
            else {

            Toast.makeText(SellerRegistrationActivity.this,"Please enter a valid email ID ",Toast.LENGTH_LONG).show();
                   }
       }

        else
        {
            Toast.makeText(SellerRegistrationActivity.this,"Please complete all Fields.  ",Toast.LENGTH_LONG).show();
        }

    }
Reply all
Reply to author
Forward
0 new messages