![](/img/trans.png)
[英]On Android, is it necessary to remove a sensor listener when an activity is destroyed?
[英]Is it really necessary to remove the complete listener Firebase Authentication?
如我的標題所述,是否有必要刪除完整的偵聽器或將this
作為第一個參數傳遞,以便刪除附加到signInWithCredential
函數的完整偵聽器?
auth.signInWithCredential(credential).addOnCompleteListener(this, ...)
如果是,如何在不通過this
情況下刪除監聽器?
不必刪除監聽器。 實際上,不可能刪除添加到由異步操作返回的Task的偵聽器。 通過傳遞this
(我認為這意味着您當前的活動),您是在告訴Task API您不想在活動銷毀后處理登錄結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.