[英]Is it really necessary to remove the complete listener Firebase Authentication?
As my title says, is it necessary to remove the complete listener or to pass this
as the first parameter in order to remove the complete listener attached to the signInWithCredential
function? 如我的标题所述,是否有必要删除完整的侦听器或将
this
作为第一个参数传递,以便删除附加到signInWithCredential
函数的完整侦听器?
auth.signInWithCredential(credential).addOnCompleteListener(this, ...)
If yes, how can I remove the listener without passing this
? 如果是,如何在不通过
this
情况下删除监听器?
It's not necessary to remove the listener. 不必删除监听器。 In fact, it's not possible to remove a listener that was added to a Task returned by an asynchronous operation.
实际上,不可能删除添加到由异步操作返回的Task的侦听器。 By passing
this
(which I assume means your current Activity), you are telling the Task API that you don't want to handle the result of the sign in after the activity is destroyed. 通过传递
this
(我认为这意味着您当前的活动),您是在告诉Task API您不想在活动销毁后处理登录结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.