gpt4 book ai didi

android - 在实现Firebase Phone Auth时,我从顶部得到一个奇怪的黑条动画

转载 作者:行者123 更新时间:2023-12-02 13:39:51 25 4
gpt4 key购买 nike

我是Android的新手。我目前正在尝试在Kotlin项目中实施Firebase Phone Auth。我注意到在等待回调时发生了一些奇怪的事情(屏幕顶部有一个黑条动画)。我没有在我的代码中这样做,也不知道如何摆脱它。有什么想法我应该做什么?
enter image description here

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.a9ts.a9ts.databinding.RegisterBinding
import com.google.firebase.FirebaseException
import com.google.firebase.auth.*
import org.jetbrains.anko.toast
import java.util.concurrent.TimeUnit

class Register : AppCompatActivity() {
private lateinit var binding : RegisterBinding
private lateinit var callbacks: PhoneAuthProvider.OnVerificationStateChangedCallbacks

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = RegisterBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.buttonNext.setOnClickListener {
val phoneNumber = binding.editTextPhoneNumber.text.toString().trim()
if (phoneNumber.isEmpty())
{
binding.editTextPhoneNumber.setError("Number is required!")
binding.editTextPhoneNumber.requestFocus()
} else {
startPhoneNumberVerification(phoneNumber)
}
}

callbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
override fun onVerificationCompleted(credential: PhoneAuthCredential) {
toast("Success!")
}

override fun onVerificationFailed(e: FirebaseException) {
toast("onVerificationFailed")
}

override fun onCodeSent(verificationId: String,token: PhoneAuthProvider.ForceResendingToken) {
toast("SMS Code sent: $verificationId")
}
}
}

private fun startPhoneNumberVerification(phoneNumber: String) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
this, // Activity (for callback binding)
callbacks) // OnVerificationStateChangedCallbacks
}
}```

最佳答案

不知道是什么原因导致了这种现象,但是回到BOM 25.12.0解决了该问题。

//implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation platform('com.google.firebase:firebase-bom:25.12.0')

关于android - 在实现Firebase Phone Auth时,我从顶部得到一个奇怪的黑条动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64587399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com