카테고리 없음 / / 2020. 3. 15. 00:41

Firebase Exception 사용 예제 모음

1.

 

 

override fun onVerificationFailed(e: FirebaseException) {
// This callback is invoked in an invalid request for verification is made,
// for instance if the the phone number format is not valid.
//Log.w("phonepart", "onVerificationFailed", e)

if (e is FirebaseAuthInvalidCredentialsException) {
et_new_member_join_phone.error = "잘못된 폰 넘버입니다"
bt_confirm_phonenumber.isClickable = true
bt_confirm_phonenumber.text = "재요청"
} else if (e is FirebaseTooManyRequestsException) {
// The SMS quota for the project has been exceeded
et_new_member_join_phone.error = "요청회수가 초과되었습니다"
bt_confirm_phonenumber.isClickable = true
bt_confirm_phonenumber.text = "재요청"
}
else if(e is FirebaseAuthException)
{
et_new_member_join_phone.error = "가상 장치에서는 인증할 수 없습니다"
bt_confirm_phonenumber.isClickable = true
bt_confirm_phonenumber.text = "재요청"
}

}

 

 

 

 

2.

fireauth.signInWithEmailAndPassword(email, "grabage")
.addOnCompleteListener { task ->
if(!task.isSuccessful)
{
with(task.exception)
{
when(this) {
is FirebaseAuthInvalidUserException -> {
responseObserver(false)
}
else -> {
responseObserver(true)
}
}
}
}
}

  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유