android-studiofirebase-authenticationrecaptchaverificationsms-verification

Firebase Phone Auth suddenly don't works. onCodeSent triggered but no SMS received


UPDATE: Suddenly I tried to attempt this time and it suddenly works without changing any codes on my application and firebase console. I don't know why/how can someone explain? Does anyone know how to prevent this issue?

ORIGINAL POST: The onCodeSent is triggered but can't receive any SMS code. It happened to me last time but it turns fine after a day. But last night I can't receive any SMS again without any changes from my android studio codes and firebase in regards to phone authentication. It is the same thing that happened the last time. And earlier as I woke up around 7:00 AM, I can receive an SMS code but then again I tried testing it out again at around 12:00 PM I can't receive any SMS again. I'm not sure what is the problem here. I need an answer as soon as possible because I need my project to be presented on defense next week. Thank you

Also tested on another device from another location. It does not receive any SMS too. Also tried my old project application which is working/receiving SMS but has the same issue.

Firebase Console:

Android Studio:

sometimes I receive an SMS code, and not sometime. Toast from onCodeSent was showing. I also try to reveal the token and verificationId and it was not null.

private void sendVerificationCode(String contactNumber) {
        PhoneAuthOptions options =
                PhoneAuthOptions.newBuilder(mAuth)
                        .setPhoneNumber(contactNumber)       // Phone number to verify
                        .setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
                        .setActivity(this)                 // Activity (for callback binding)
                        .setCallbacks(new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
                            @Override
                            public void onVerificationCompleted(PhoneAuthCredential credential) {
                                signInWithPhoneAuthCredential(credential);
                                loading.dismiss();
                            }

                            @Override
                            public void onVerificationFailed(FirebaseException e) {
                                Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
                                loading.dismiss();
                            }

                            @Override
                            public void onCodeSent(@NonNull String verificationId,
                                                   @NonNull PhoneAuthProvider.ForceResendingToken token) {
                                verificationDialog(contactNumber);
                                verificationCode = verificationId;
                                loading.dismiss();
                                Toast.makeText(getApplicationContext(), "Verification code sent to " + contactNumber, Toast.LENGTH_LONG).show();
                            }
                        })          // OnVerificationStateChangedCallbacks
                        .build();
        PhoneAuthProvider.verifyPhoneNumber(options);
    }

Solution

  • enter image description here

    80% - So this is the answer to my question. Bye