Ad

Android Firebase OnEmailVerifiedListener

I have a verify email activity - "We send email to.." and so on. I want to create "onEmailVerifiedListener" by starting the thread in this way:

private fun startThread(){
    thread = object: Thread(){
        override fun run() {
            while(threadRunning){
                Log.d("VERIFYTAG", "${auth.currentUser!!.isEmailVerified}")
                checkUserHasVerifiedEmail()
                sleep(3000)
            }
        }
    }
    thread.start()
}

But even that I verify my e-mail address - auth.currentUser!!.isEmailVerified returns false:

2019-07-03 13:54:49.923 18799-19018/pl.project.project D/VERIFYTAG: false

Why is the FirebaseAuth lying?

Ad

Answer

I had to add one line of code: auth.currentUser!!.reload()

Hope it help you

Ad
source: stackoverflow.com
Ad