在应用程序身份验证中,无法从手机上的Firebase接收SMS

时间:2019-07-09 09:38:43

标签: android firebase-authentication

->无法通过身份验证从电话上的Firebase接收短信

developed sample application, its working fine with hardcoded phone numbers, and code at Firebase, but when I am entering actual phone number on mobile device getting SHA-1 certificate error.

由于应用程序可以很好地使用预定义的手机号码和代码,因此我认为需要启用某些设置才能通过电话接收短信。

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    public static final int RC_SIGN_IN = 001;
    private static final String TAG = MainActivity.class.getSimpleName();

    private EditText phoneNumberField , smsCodeVerificationField  ;
    private Button startVerficationButton , verifyPhoneButton ;


    private FirebaseAuth mAuth;


    private boolean mVerificationInProgress = false;
    private String mVerificationId, verificationid;
    private PhoneAuthProvider.ForceResendingToken mResendToken;
    private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks;
}

  @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        mAuth = FirebaseAuth.getInstance();;
        phoneNumberField  = findViewById(R.id.phone_number_edt);
        smsCodeVerificationField  = findViewById(R.id.sms_code_edt);
        startVerficationButton = findViewById(R.id.start_auth_button);
        verifyPhoneButton  = findViewById(R.id.verify_auth_button);
        startVerficationButton.setOnClickListener(this);
        verifyPhoneButton.setOnClickListener(this);
    }

0 个答案:

没有答案