Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String phoneNum = "+16505554567";
- String testVerificationCode = "123456";
- // Whenever verification is triggered with the whitelisted number,
- // provided it is not set for auto-retrieval, onCodeSent will be triggered.
- PhoneAuthProvider.getInstance().verifyPhoneNumber(
- phoneNum, 30L /*timeout*/, TimeUnit.SECONDS,
- this, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
- @Override
- public void onCodeSent(String verificationId,
- PhoneAuthProvider.ForceResendingToken forceResendingToken) {
- // Save the verification id somewhere
- // ...
- // The corresponding whitelisted code above should be used to complete sign-in.
- MainActivity.this.enableUserManuallyInputCode();
- }
- @Override
- public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
- // Sign in with the credential
- // ...
- }
- @Override
- public void onVerificationFailed(FirebaseException e) {
- // ...
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement