Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Authentication: Fragment(){
- private lateinit var mCallbacks: PhoneAuthProvider.OnVerificationStateChangedCallbacks
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
- return inflater.inflate(R.layout.auth,container,false)
- }
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- authBtn.setOnClickListener{
- progressBar.setVisibility(View.VISIBLE)
- edt_number.setEnabled(false)
- authBtn.setEnabled(false)
- val phone = edt_number.text.toString()
- PhoneAuthProvider.getInstance().verifyPhoneNumber(
- phone, // Phone number to verify
- 60, // Timeout duration
- TimeUnit.SECONDS, // Unit of timeout
- activity!!, // Activity (for callback binding)
- mCallbacks)
- mCallbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
- override fun onVerificationCompleted(p0: PhoneAuthCredential?) {
- }
- override fun onVerificationFailed(p0: FirebaseException?) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
- }
- }
- }
- mCallbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
- override fun onVerificationCompleted(p0: PhoneAuthCredential?) {
- }
- override fun onVerificationFailed(p0: FirebaseException?) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
- }
- PhoneAuthProvider.getInstance().verifyPhoneNumber(
- phone, // Phone number to verify
- 60, // Timeout duration
- TimeUnit.SECONDS, // Unit of timeout
- activity!!, // Activity (for callback binding)
- mCallbacks)
Add Comment
Please, Sign In to add comment