Почему не проходит верификация номера телефона firebase?

История такова, когда я работаю на прямую из Android Studio всё работает, но стоит мне создать apk файл, то верификация телефона просто не работает. Я взял проверку на квоту из документации. Но выводит ERROR на отработанную проверку ниже в коде. В чём проблема? У меня подозрение, на то что Google Сервисы не хотят сотрудничить с моим приложением, потому что когда я устанавливал приложение у меня вылетело окно Play Защиты, оно придупредило о не проверенном источнике.

    private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    mAuth = FirebaseAuth.getInstance();
    mCurrentUser = mAuth.getCurrentUser();
    firebaseFirestore = FirebaseFirestore.getInstance();
    user_id = mAuth.getUid();

    mCountyCode = findViewById(R.id.country_code);
    mPhone = findViewById(R.id.phone);
    send_btn = findViewById(R.id.send_message_btn);
    send_progress_bar = findViewById(R.id.send_message_progress_bar);
    helpTextWorking = findViewById(R.id.helpTextWorking);

    send_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String county_code = mCountyCode.getText().toString();
            String phone_number = mPhone.getText().toString();

            String full_phone_number = "+" + county_code + "" + phone_number;

            if(county_code.isEmpty() || phone_number.isEmpty()){
                helpTextWorking.setText("Please Fill in the form to continue");
                helpTextWorking.setVisibility(View.VISIBLE);
            } else {
                send_progress_bar.setVisibility(View.VISIBLE);
                send_btn.setEnabled(false);

                PhoneAuthProvider.getInstance().verifyPhoneNumber(
                        full_phone_number,
                        60,
                        TimeUnit.SECONDS,
                        LoginActivity.this,
                        mCallbacks
                );
            }
        }
    });

    mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
        @Override
        public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
            signInWithPhoneAuthCredential(phoneAuthCredential);
        }

        @Override
        public void onVerificationFailed(FirebaseException e) {
            if(e instanceof  FirebaseAuthInvalidCredentialsException){
                helpTextWorking.setText("Verifecation Failed, please try again.");
                helpTextWorking.setVisibility(View.VISIBLE);
                send_progress_bar.setVisibility(View.INVISIBLE);
                send_btn.setEnabled(true);
            } else if (e instanceof FirebaseTooManyRequestsException){
                helpTextWorking.setText("The SMS quota for the project has been exceede.");
                helpTextWorking.setVisibility(View.VISIBLE);
                send_progress_bar.setVisibility(View.INVISIBLE);
                send_btn.setEnabled(true);
            }
            helpTextWorking.setText("ERROR");
            helpTextWorking.setVisibility(View.VISIBLE);
            send_progress_bar.setVisibility(View.INVISIBLE);
            send_btn.setEnabled(true);
        }

        @Override
        public void onCodeSent(final String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
            super.onCodeSent(s, forceResendingToken);

            new android.os.Handler().postDelayed(
                    new Runnable() {
                        public void run() {
                            mCountyCode = findViewById(R.id.country_code);
                            mPhone = findViewById(R.id.phone);

                            String phone = "+" + mCountyCode.getText().toString() + "" + mPhone.getText().toString();
                            Intent otpIntent = new Intent(LoginActivity.this, OtpActivity.class);
                            otpIntent.putExtra("AuthCredentials", s);
                            otpIntent.putExtra("phone", phone);
                            startActivity(otpIntent);
                        }
                    },
                    10000);
        }
    };

}

@Override
protected void onStart() {
    super.onStart();
    if(mCurrentUser != null){
        sendUserToHome();
    }
}

private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        mCountyCode = findViewById(R.id.country_code);
                        mPhone = findViewById(R.id.phone);

                        String full_phone = "+" + mCountyCode.getText().toString() + "" + mPhone.getText().toString();

                        firebaseFirestore.collection("users").document(full_phone).get()
                                .addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
                                    @Override
                                    public void onComplete(@NonNull Task<DocumentSnapshot> task) {
                                        if(!task.getResult().exists())
                                        {
                                            Intent registerIntent = new Intent(LoginActivity.this, RegistratorActivity.class);
                                            registerIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                            registerIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                                            startActivity(registerIntent);
                                            finish();
                                        } else {
                                            sendUserToHome();
                                        }
                                    }
                                });
                    } else {
                        if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
                            // The verification code entered was invalid
                            helpTextWorking.setVisibility(View.VISIBLE);
                            helpTextWorking.setText("There was an error verifying OTP");
                        }
                    }
                    send_progress_bar.setVisibility(View.INVISIBLE);
                    send_btn.setEnabled(true);
                }
            });
}

private void sendUserToHome(){
    Intent homeIntent = new Intent(LoginActivity.this, MainActivity.class);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    startActivity(homeIntent);
    finish();
}

}


Ответы (0 шт):